Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
intranet-synchronizer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mauro Paolo Josue Zuñiga Mallqui
intranet-synchronizer
Commits
a00701f3
Commit
a00701f3
authored
Jul 27, 2026
by
Mauro Paolo Josue Zuñiga Mallqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(students): renombrar LevelName/GradeName a Level/Grade
parent
3bef96db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
2 deletions
+87
-2
entity.go
internal/students/entity.go
+2
-2
reader.go
internal/students/reader.go
+85
-0
No files found.
internal/students/entity.go
View file @
a00701f3
...
@@ -19,9 +19,9 @@ type Student struct {
...
@@ -19,9 +19,9 @@ type Student struct {
BranchID
*
int
`bson:"branch_id"`
BranchID
*
int
`bson:"branch_id"`
BranchName
*
string
`bson:"branch"`
BranchName
*
string
`bson:"branch"`
LevelID
*
int
`bson:"level_id"`
LevelID
*
int
`bson:"level_id"`
Level
Name
*
string
`bson:"level"`
Level
*
string
`bson:"level"`
GradeID
*
int
`bson:"grade_id"`
GradeID
*
int
`bson:"grade_id"`
Grade
Name
*
string
`bson:"grade"`
Grade
*
string
`bson:"grade"`
ClassroomAttendanceID
*
int
`bson:"classroom_attendance_id"`
ClassroomAttendanceID
*
int
`bson:"classroom_attendance_id"`
UpdatedAt
time
.
Time
`bson:"updated_at"`
UpdatedAt
time
.
Time
`bson:"updated_at"`
RowHash
string
`bson:"row_hash,omitempty" json:"-"`
RowHash
string
`bson:"row_hash,omitempty" json:"-"`
...
...
internal/students/reader.go
0 → 100644
View file @
a00701f3
package
students
import
(
"context"
"fmt"
"time"
"intranet-sycronizacion/internal/db"
appsync
"intranet-sycronizacion/internal/sync"
)
// QueryReader ejecuta Query directamente y arma una SyncRow por fila del resultado.
type
QueryReader
struct
{
pool
*
db
.
Pool
query
string
}
// NewQueryReader construye el reader de estudiantes sobre el pool dado.
func
NewQueryReader
(
pool
*
db
.
Pool
,
query
string
)
*
QueryReader
{
return
&
QueryReader
{
pool
:
pool
,
query
:
query
}
}
// FetchAll corre la consulta y lee fila por fila.
func
(
f
*
QueryReader
)
FetchAll
(
ctx
context
.
Context
)
([]
appsync
.
SyncRow
,
error
)
{
rows
,
err
:=
f
.
pool
.
Pool
.
Query
(
ctx
,
f
.
query
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"query students: %w"
,
err
)
}
defer
rows
.
Close
()
var
result
[]
appsync
.
SyncRow
for
rows
.
Next
()
{
var
(
studentID
int
studentCode
*
string
studentInternalCode
*
string
paternalLastName
*
string
maternalLastName
*
string
name
*
string
dni
*
string
birthday
*
time
.
Time
email
*
string
genreID
*
int
genre
*
string
branchID
*
int
branchName
*
string
levelID
*
int
levelName
*
string
gradeID
*
int
gradeName
*
string
classroomAttendanceID
*
int
)
if
err
:=
rows
.
Scan
(
&
studentID
,
&
studentCode
,
&
studentInternalCode
,
&
paternalLastName
,
&
maternalLastName
,
&
name
,
&
dni
,
&
birthday
,
&
email
,
&
genreID
,
&
genre
,
&
branchID
,
&
branchName
,
&
levelID
,
&
levelName
,
&
gradeID
,
&
gradeName
,
&
classroomAttendanceID
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"scan student row: %w"
,
err
)
}
doc
:=
&
Student
{
StudentID
:
studentID
,
StudentCode
:
studentCode
,
StudentInternalCode
:
studentInternalCode
,
PaternalLastName
:
paternalLastName
,
MaternalLastName
:
maternalLastName
,
Name
:
name
,
DNI
:
dni
,
Birthday
:
birthday
,
Email
:
email
,
GenreID
:
genreID
,
Genre
:
genre
,
BranchID
:
branchID
,
BranchName
:
branchName
,
LevelID
:
levelID
,
Level
:
levelName
,
GradeID
:
gradeID
,
Grade
:
gradeName
,
ClassroomAttendanceID
:
classroomAttendanceID
,
}
result
=
append
(
result
,
appsync
.
SyncRow
{
ID
:
studentID
,
Doc
:
doc
})
}
if
err
:=
rows
.
Err
();
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"iterate student rows: %w"
,
err
)
}
return
result
,
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment