* implement --silent flag to control output verbosity * update error handling to restore stderr after silent mode * enhance progress reporting in PostgreSQL reader
35 lines
937 B
Go
35 lines
937 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,
|
|
Prisma7: prisma7,
|
|
ContinueOnError: continueOnError,
|
|
StrictDirectives: strictDirectives,
|
|
}
|
|
}
|