Documentation ¶
Overview ¶
Package database provides the ability for Vela to integrate with different supported SQL backends.
Usage:
import "github.com/go-vela/server/database"
Index ¶
- Variables
- func ToContext(c Setter, d Interface)
- type EngineOpt
- func WithAddress(address string) EngineOpt
- func WithCompressionLevel(level int) EngineOpt
- func WithConnectionIdle(connectionIdle int) EngineOpt
- func WithConnectionLife(connectionLife time.Duration) EngineOpt
- func WithConnectionOpen(connectionOpen int) EngineOpt
- func WithDriver(driver string) EngineOpt
- func WithEncryptionKey(encryptionKey string) EngineOpt
- func WithSkipCreation(skipCreation bool) EngineOpt
- type Interface
- type Setter
Constants ¶
This section is empty.
Variables ¶
var Flags = []cli.Flag{ &cli.StringFlag{ EnvVars: []string{"VELA_DATABASE_DRIVER", "DATABASE_DRIVER"}, FilePath: "/vela/database/driver", Name: "database.driver", Usage: "driver to be used for the database system", Value: "sqlite3", }, &cli.StringFlag{ EnvVars: []string{"VELA_DATABASE_ADDR", "DATABASE_ADDR"}, FilePath: "/vela/database/addr", Name: "database.addr", Usage: "fully qualified url (<scheme>://<host>) for the database", Value: "vela.sqlite", }, &cli.IntFlag{ EnvVars: []string{"VELA_DATABASE_CONNECTION_OPEN", "DATABASE_CONNECTION_OPEN"}, FilePath: "/vela/database/connection_open", Name: "database.connection.open", Usage: "maximum number of open connections to the database", Value: 0, }, &cli.IntFlag{ EnvVars: []string{"VELA_DATABASE_CONNECTION_IDLE", "DATABASE_CONNECTION_IDLE"}, FilePath: "/vela/database/connection_idle", Name: "database.connection.idle", Usage: "maximum number of idle connections to the database", Value: 2, }, &cli.DurationFlag{ EnvVars: []string{"VELA_DATABASE_CONNECTION_LIFE", "DATABASE_CONNECTION_LIFE"}, FilePath: "/vela/database/connection_life", Name: "database.connection.life", Usage: "duration of time a connection may be reused for the database", Value: 30 * time.Minute, }, &cli.IntFlag{ EnvVars: []string{"VELA_DATABASE_COMPRESSION_LEVEL", "DATABASE_COMPRESSION_LEVEL"}, FilePath: "/vela/database/compression_level", Name: "database.compression.level", Usage: "level of compression for logs stored in the database", Value: constants.CompressionThree, }, &cli.StringFlag{ EnvVars: []string{"VELA_DATABASE_ENCRYPTION_KEY", "DATABASE_ENCRYPTION_KEY"}, FilePath: "/vela/database/encryption_key", Name: "database.encryption.key", Usage: "AES-256 key for encrypting and decrypting values in the database", }, &cli.BoolFlag{ EnvVars: []string{"VELA_DATABASE_SKIP_CREATION", "DATABASE_SKIP_CREATION"}, FilePath: "/vela/database/skip_creation", Name: "database.skip_creation", Usage: "enables skipping the creation of tables and indexes in the database", }, }
Flags represents all supported command line interface (CLI) flags for the database.
Functions ¶
Types ¶
type EngineOpt ¶ added in v0.20.0
type EngineOpt func(*engine) error
EngineOpt represents a configuration option to initialize the database engine.
func WithAddress ¶ added in v0.20.0
WithAddress sets the address in the database engine.
func WithCompressionLevel ¶ added in v0.20.0
WithCompressionLevel sets the compression level in the database engine.
func WithConnectionIdle ¶ added in v0.20.0
WithConnectionIdle sets the idle connections in the database engine.
func WithConnectionLife ¶ added in v0.20.0
WithConnectionLife sets the life of connections in the database engine.
func WithConnectionOpen ¶ added in v0.20.0
WithConnectionOpen sets the open connections in the database engine.
func WithDriver ¶ added in v0.20.0
WithDriver sets the driver in the database engine.
func WithEncryptionKey ¶ added in v0.20.0
WithEncryptionKey sets the encryption key in the database engine.
func WithSkipCreation ¶ added in v0.20.0
WithSkipCreation sets the skip creation logic in the database engine.
type Interface ¶ added in v0.20.0
type Interface interface { // Close defines a function that stops and terminates the connection to the database. Close() error // Driver defines a function that outputs the configured database driver. Driver() string // Ping defines a function that sends a "ping" request to the configured database. Ping() error // BuildInterface defines the interface for builds stored in the database. build.BuildInterface // HookInterface defines the interface for hooks stored in the database. hook.HookInterface // LogInterface defines the interface for logs stored in the database. log.LogInterface // PipelineInterface defines the interface for pipelines stored in the database. pipeline.PipelineInterface // RepoInterface defines the interface for repos stored in the database. repo.RepoInterface // ScheduleInterface defines the interface for schedules stored in the database. schedule.ScheduleInterface // SecretInterface defines the interface for secrets stored in the database. secret.SecretInterface // ServiceInterface defines the interface for services stored in the database. service.ServiceInterface // StepInterface defines the interface for steps stored in the database. step.StepInterface // UserInterface defines the interface for users stored in the database. user.UserInterface // WorkerInterface defines the interface for workers stored in the database. worker.WorkerInterface }
Interface represents the interface for integrating with the supported database providers.
func FromCLIContext ¶ added in v0.20.0
FromCLIContext creates and returns a database engine from the urfave/cli context.
func FromContext ¶
FromContext returns the database Interface associated with this context.