Documentation ¶
Index ¶
- Constants
- func EvaluateDefines(c *PreConfig, f []byte) ([]byte, error)
- func ExpandDefines(pc *PreConfig)
- func MergeUserDefines(pc *PreConfig, uargv *Args)
- type Args
- type ArgsFlag
- type Config
- type Ctx
- func (ctx *Ctx) ExecConfig(config *Config, uargs *Args) error
- func (ctx *Ctx) ExecDir(c *Config, db interface{}, dirPath string, uargv *Args) error
- func (ctx *Ctx) ExecFile(c *Config, db interface{}, filePath string, uargv *Args) error
- func (ctx *Ctx) ExecLines(db interface{}, cc []string, uargv *Args) (int, error)
- func (ctx *Ctx) ExecPath(c *Config, db interface{}, path string, uargv *Args) error
- func (ctx *Ctx) ExecPaths(c *Config, db interface{}, paths []string, uargv *Args) error
- func (ctx *Ctx) ExecTarget(basepath string, target *Target, uargv *Args, c *Config) error
- type Exec
- type MapFlags
- type MapValues
- type PreConfig
- type Target
Constants ¶
View Source
const Version = "v1.3.2"
Variables ¶
This section is empty.
Functions ¶
func ExpandDefines ¶ added in v1.3.0
func ExpandDefines(pc *PreConfig)
func MergeUserDefines ¶ added in v1.3.0
Types ¶
type Args ¶
type Args struct { ConfigPath string Verbose bool ExtraVerbose bool Execute bool Raw bool Demand MapFlags Set MapValues }
it would be nice for golang to support bit fields. Bit fields are very elegant solution, hovewer since golang doesnt support them, We must introduce a lot of code, which makes program slower and more complex. Thats why i decided to waste some memory and introduce separate boolean fields. In future if number of those fields will increase we could make it bit fields.
func NewArgsFromCli ¶
func NewArgsFromCli() *Args
type Config ¶
these arrays really should be hash tables. deal with it.
func NewConfigFromBytes ¶ added in v1.3.2
type Ctx ¶
type Ctx struct { GetMergeScript func( c *Config, dbCtx interface{}, target *Target, args []string) (string, error) DbNew func(*Target) (interface{}, error) DbClose func(dbCtx interface{}) DbPing func(dbCtx interface{}) error DbExec func(dbCtx interface{}, stmt string, args ...interface{}) error DbSuffix string }
type PreConfig ¶ added in v1.1.0
type PreConfig struct { Version string /* stupid-simple version of C preprocessor ( but in yaml ) for example if you place: defines: - db : my_database - foo: bar will replace any occurrence of ${db} with my_database and ${foo} with bar ANYWHERE in dp files. It is like preprocessor -> dp-file gets loaded (it may be script, table, type and so on...) all defines are being 'evaluated' from top to bottom file is parsed into yaml structure / executed if sql and so on... it also allows for more advanced usage like so: defines: - db : test_db - drop_db : drop database ${db} - create_db: create database ${db} ... targets: - name: foo .... exec: - type: stmt args: ["${drop_db}", "${create_db}"] */ Defines []map[string]string }
preconfig is getting parsed before actual config. preconfig must be contained in any config structure no matter version, it contains version meta data and preprocessor directives
Click to show internal directories.
Click to hide internal directories.