Skip to content

Commit

Permalink
Disentangle CLI logic from libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
williammoran committed May 10, 2024
1 parent df1df48 commit 16f66f3
Show file tree
Hide file tree
Showing 38 changed files with 1,107 additions and 1,103 deletions.
42 changes: 42 additions & 0 deletions lib/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package lib

import (
"log/slog"

"github.com/dbsteward/dbsteward/lib/ir"
)

// Config is a structure containing all configuration information
// for any execution of code.
type Config struct {
Logger *slog.Logger
SqlFormat ir.SqlFormat
CreateLanguages bool
RequireSlonyId bool
RequireSlonySetId bool
GenerateSlonik bool
SlonyIdStartValue uint
SlonyIdSetValue uint
OutputFileStatementLimit uint
IgnoreCustomRoles bool
IgnorePrimaryKeyErrors bool
RequireVerboseIntervalNotation bool
QuoteSchemaNames bool
QuoteObjectNames bool
QuoteTableNames bool
QuoteFunctionNames bool
QuoteColumnNames bool
QuoteAllNames bool
QuoteIllegalIdentifiers bool
QuoteReservedIdentifiers bool
OnlySchemaSql bool
OnlyDataSql bool
LimitToTables map[string][]string
SingleStageUpgrade bool
FileOutputDirectory string
FileOutputPrefix string
IgnoreOldNames bool
AlwaysRecreateViews bool
OldDatabase *ir.Definition
NewDatabase *ir.Definition
}
18 changes: 0 additions & 18 deletions lib/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,4 @@ package lib

import "github.com/dbsteward/dbsteward/lib/ir"

type Mode uint

const (
ModeUnknown Mode = 0
ModeXmlDataInsert Mode = 1
ModeXmlSort Mode = 2
ModeXmlConvert Mode = 4
ModeBuild Mode = 8
ModeDiff Mode = 16
ModeExtract Mode = 32
ModeDbDataDiff Mode = 64
ModeXmlSlonyId Mode = 73
ModeSqlDiff Mode = 128
ModeSlonikConvert Mode = 256
ModeSlonyCompare Mode = 512
ModeSlonyDiff Mode = 1024
)

const DefaultSqlFormat = ir.SqlFormatPgsql8
Loading

0 comments on commit 16f66f3

Please sign in to comment.