Adds WriterOptions.TypeMappings and a repeatable --type-map sqltype=gotype flag. Defaults are unchanged when no mapping is given. Closes #36 (bun/gorm). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
36 lines
971 B
Go
36 lines
971 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.warky.dev/wdevs/relspecgo/pkg/readers"
|
|
"git.warky.dev/wdevs/relspecgo/pkg/writers"
|
|
)
|
|
|
|
func newReaderOptions(filePath, connString string) *readers.ReaderOptions {
|
|
return &readers.ReaderOptions{
|
|
FilePath: filePath,
|
|
ConnectionString: connString,
|
|
Prisma7: prisma7,
|
|
StrictDirectives: strictDirectives,
|
|
Progress: func(message string) {
|
|
fmt.Fprintf(os.Stderr, " → %s\n", message)
|
|
},
|
|
}
|
|
}
|
|
|
|
func newWriterOptions(outputPath, packageName string, flattenSchema bool, nullableTypes, nullableArrays string, continueOnError bool) *writers.WriterOptions {
|
|
return &writers.WriterOptions{
|
|
OutputPath: outputPath,
|
|
PackageName: packageName,
|
|
FlattenSchema: flattenSchema,
|
|
NullableTypes: nullableTypes,
|
|
NullableArrays: nullableArrays,
|
|
TypeMappings: typeMappings,
|
|
Prisma7: prisma7,
|
|
ContinueOnError: continueOnError,
|
|
StrictDirectives: strictDirectives,
|
|
}
|
|
}
|