chore: Fixed linitng issues

This commit is contained in:
2026-07-18 22:41:23 +02:00
parent 2aecd1312e
commit 7d93bee4bd
2 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -393,7 +393,7 @@ func writeDatabase(db *models.Database, dbType, outputPath, packageName, schemaF
writerOpts := newWriterOptions(outputPath, packageName, flattenSchema, nullableTypes, continueOnError) writerOpts := newWriterOptions(outputPath, packageName, flattenSchema, nullableTypes, continueOnError)
if extraFields != "" { if extraFields != "" {
if strings.ToLower(dbType) != "bun" { if !strings.EqualFold(dbType, "bun") {
return fmt.Errorf("--extra-fields is only supported for Bun output") return fmt.Errorf("--extra-fields is only supported for Bun output")
} }
extraFieldsJSON, err := os.ReadFile(extraFields) extraFieldsJSON, err := os.ReadFile(extraFields)
+4 -5
View File
@@ -29,15 +29,14 @@ const pgCastMarker = "\x00PGCAST\x00"
// A placeholder that appears more than once maps to the same $N. An unknown // A placeholder that appears more than once maps to the same $N. An unknown
// placeholder (not built-in and not in staticParams) returns an error. // placeholder (not built-in and not in staticParams) returns an error.
// PostgreSQL cast syntax (::type) is left untouched. // PostgreSQL cast syntax (::type) is left untouched.
func BuildQuery(call string, fileBytes []byte, filename string, staticParams map[string]string) (string, []any, error) { func BuildQuery(call string, fileBytes []byte, filename string, staticParams map[string]string) (query string, args []any, err error) {
// Protect :: casts before running the placeholder regex. // Protect :: casts before running the placeholder regex.
protected := strings.ReplaceAll(call, "::", pgCastMarker) protected := strings.ReplaceAll(call, "::", pgCastMarker)
paramIndex := map[string]int{} // name → 1-based position paramIndex := map[string]int{} // name → 1-based position
var args []any
var firstErr error var firstErr error
result := namedPlaceholder.ReplaceAllStringFunc(protected, func(match string) string { query = namedPlaceholder.ReplaceAllStringFunc(protected, func(match string) string {
if firstErr != nil { if firstErr != nil {
return match return match
} }
@@ -78,9 +77,9 @@ func BuildQuery(call string, fileBytes []byte, filename string, staticParams map
} }
// Restore :: casts. // Restore :: casts.
result = strings.ReplaceAll(result, pgCastMarker, "::") query = strings.ReplaceAll(query, pgCastMarker, "::")
return result, args, nil return query, args, nil
} }
// ExecuteItem reads the asset file referenced by item.Entry.File (which is the // ExecuteItem reads the asset file referenced by item.Entry.File (which is the