@@ -19,10 +19,10 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
1919 columnNames := tableInfo .Columns .ColumnNames ()
2020 pks := tableInfo .Columns .PrimaryKeys ()
2121
22- // const Find {StructName}ByPKQuery = `SELECT {column_name1}, {column_name2} FROM {table_name} WHERE {pk1} = ? [AND ...]`
22+ // const Get {StructName}ByPKQuery = `SELECT {column_name1}, {column_name2} FROM {table_name} WHERE {pk1} = ? [AND ...]`
2323 //
24- // func (q *query) Find {StructName}ByPK(ctx context.Context, queryer QueryerContext, pk1 pk1type, ...) ({Struct}, error) {
25- // row := queryer.QueryRowContext(ctx, Find {StructName}Query, pk1, ...)
24+ // func (q *query) Get {StructName}ByPK(ctx context.Context, queryer QueryerContext, pk1 pk1type, ...) ({Struct}, error) {
25+ // row := queryer.QueryRowContext(ctx, Get {StructName}Query, pk1, ...)
2626 // var s {Struct}
2727 // if err := row.Scan(
2828 // &s.{ColumnName1},
@@ -32,7 +32,7 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
3232 // }
3333 // return &s, nil
3434 // }
35- byPKFuncName := "Find" + structName + "ByPK"
35+ byPKFuncName := readOneFuncPrefix + structName + "ByPK"
3636 byPKQueryName := byPKFuncName + "Query"
3737 astFile .Decls = append (astFile .Decls ,
3838 & ast.GenDecl {
@@ -79,7 +79,7 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
7979 }},
8080 },
8181 Body : & ast.BlockStmt {
82- // row, err := queryer.QueryRowContext(ctx, Find {StructName}Query, pk1, ...)
82+ // row, err := queryer.QueryRowContext(ctx, Get {StructName}Query, pk1, ...)
8383 List : []ast.Stmt {
8484 & ast.ExprStmt {
8585 // LoggerFromContext(ctx).Debug(queryName)
@@ -165,10 +165,10 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
165165
166166 hasOneColumnsByTag := tableInfo .HasOneTagColumnsByTag ()
167167 for _ , hasOneTag := range tableInfo .HasOneTags {
168- // const Find {StructName}By{FieldName}Query = `SELECT {column_name1}, {column_name2} FROM {table_name} WHERE {column} = ? [AND ...]`
168+ // const Get {StructName}By{FieldName}Query = `SELECT {column_name1}, {column_name2} FROM {table_name} WHERE {column} = ? [AND ...]`
169169 //
170- // func (q *queryer) Find {StructName}ByColumn1[AndColumn2](ctx context.Context, queryer QueryerContext, {ColumnName} {ColumnType} [, {Column2Name} {Column2Type}]) ({Struct}Slice, error) {
171- // row := queryer.QueryRowContext(ctx, Find {StructName}Query, {ColumnName}, {Column2Name})
170+ // func (q *queryer) Get {StructName}ByColumn1[AndColumn2](ctx context.Context, queryer QueryerContext, {ColumnName} {ColumnType} [, {Column2Name} {Column2Type}]) ({Struct}Slice, error) {
171+ // row := queryer.QueryRowContext(ctx, Get {StructName}Query, {ColumnName}, {Column2Name})
172172 // var s {Struct}
173173 // if err := row.Scan(
174174 // &s.{ColumnName1},
@@ -178,7 +178,7 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
178178 // }
179179 // return &s, nil
180180 // }
181- byHasOneTagFuncName := "Find" + structName + "By" + hasOneTag
181+ byHasOneTagFuncName := readOneFuncPrefix + structName + "By" + hasOneTag
182182 byHasOneTagQueryName := byHasOneTagFuncName + "Query"
183183 hasOneColumns := hasOneColumnsByTag [hasOneTag ]
184184 astFile .Decls = append (astFile .Decls ,
@@ -226,7 +226,7 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
226226 }},
227227 },
228228 Body : & ast.BlockStmt {
229- // row, err := queryer.QueryRowContext(ctx, Find {StructName}Query, column1, ...)
229+ // row, err := queryer.QueryRowContext(ctx, Get {StructName}Query, column1, ...)
230230 List : []ast.Stmt {
231231 & ast.ExprStmt {
232232 // LoggerFromContext(ctx).Debug(queryName)
@@ -343,7 +343,7 @@ func generateREADContent(astFile *ast.File, arcSrcSet *ARCSourceSet) {
343343 if sliceSuffix := config .GoSliceTypeSuffix (); sliceSuffix != "" {
344344 structSliceType = importName + "." + structName + sliceSuffix
345345 }
346- byHasOneTagFuncName := "List" + structName + "By" + hasManyTag
346+ byHasOneTagFuncName := readManyFuncPrefix + structName + "By" + hasManyTag
347347 byHasOneTagQueryName := byHasOneTagFuncName + "Query"
348348 hasManyColumns := hasManyColumnsByTag [hasManyTag ]
349349 astFile .Decls = append (astFile .Decls ,
0 commit comments