Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 784dc1f0da | |||
| 7d93bee4bd |
@@ -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)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Maintainer: Hein (Warky Devs) <hein@warky.dev>
|
# Maintainer: Hein (Warky Devs) <hein@warky.dev>
|
||||||
pkgname=relspec
|
pkgname=relspec
|
||||||
pkgver=1.0.62
|
pkgver=1.0.63
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="RelSpec is a comprehensive database relations management tool that reads, transforms, and writes database table specifications across multiple formats and ORMs."
|
pkgdesc="RelSpec is a comprehensive database relations management tool that reads, transforms, and writes database table specifications across multiple formats and ORMs."
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Name: relspec
|
Name: relspec
|
||||||
Version: 1.0.62
|
Version: 1.0.63
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: RelSpec is a comprehensive database relations management tool that reads, transforms, and writes database table specifications across multiple formats and ORMs.
|
Summary: RelSpec is a comprehensive database relations management tool that reads, transforms, and writes database table specifications across multiple formats and ORMs.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user