database

package
v1.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGormLogger added in v0.4.23

func GetGormLogger(ctx context.Context, logConfig *logger.Config) gormLogger.Interface

GetGormLogger converts between the flytestdlib configured log level to the equivalent gorm log level and outputs a gorm/logger implementation accordingly configured.

Types

type DbConfig

type DbConfig struct {
	// deprecated: Please use Postgres.Host
	DeprecatedHost string `json:"host" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.Port
	DeprecatedPort int `json:"port" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.DbName
	DeprecatedDbName string `json:"dbname" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.User
	DeprecatedUser string `json:"username" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.Password
	DeprecatedPassword string `json:"password" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.PasswordPath
	DeprecatedPasswordPath string `json:"passwordPath" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.ExtraOptions
	DeprecatedExtraOptions string `json:"options" pflag:"-,deprecated"`
	// deprecated: Please use Postgres.Debug
	DeprecatedDebug bool `json:"debug" pflag:"-,deprecated"`

	EnableForeignKeyConstraintWhenMigrating bool            `json:"enableForeignKeyConstraintWhenMigrating" pflag:",Whether to enable gorm foreign keys when migrating the db"`
	MaxIdleConnections                      int             `json:"maxIdleConnections" pflag:",maxIdleConnections sets the maximum number of connections in the idle connection pool."`
	MaxOpenConnections                      int             `json:"maxOpenConnections" pflag:",maxOpenConnections sets the maximum number of open connections to the database."`
	ConnMaxLifeTime                         config.Duration `json:"connMaxLifeTime" pflag:",sets the maximum amount of time a connection may be reused"`
	Postgres                                PostgresConfig  `json:"postgres,omitempty"`
	SQLite                                  SQLiteConfig    `json:"sqlite,omitempty"`
}

DbConfig is used to for initiating the database connection with the store that holds registered entities (e.g. workflows, tasks, launch plans...)

func GetConfig

func GetConfig() *DbConfig

func (DbConfig) GetPFlagSet

func (cfg DbConfig) GetPFlagSet(prefix string) *pflag.FlagSet

GetPFlagSet will return strongly types pflags for all fields in DbConfig and its nested types. The format of the flags is json-name.json-sub-name... etc.

type PostgresConfig

type PostgresConfig struct {
	Host   string `json:"host" pflag:",The host name of the database server"`
	Port   int    `json:"port" pflag:",The port name of the database server"`
	DbName string `json:"dbname" pflag:",The database name"`
	User   string `json:"username" pflag:",The database user who is connecting to the server."`
	// Either Password or PasswordPath must be set.
	Password     string `json:"password" pflag:",The database password."`
	PasswordPath string `json:"passwordPath" pflag:",Points to the file containing the database password."`
	ExtraOptions string `` /* 135-byte string literal not displayed */
	Debug        bool   `json:"debug" pflag:" Whether or not to start the database connection with debug mode enabled."`
}

PostgresConfig includes specific config options for opening a connection to a postgres database.

func (PostgresConfig) IsEmpty

func (s PostgresConfig) IsEmpty() bool

type SQLiteConfig

type SQLiteConfig struct {
	File string `` /* 167-byte string literal not displayed */
}

SQLiteConfig can be used to configure

func (SQLiteConfig) IsEmpty

func (s SQLiteConfig) IsEmpty() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL