storage

package
v0.0.0-...-feb181f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Storage

The storage package provides a way to initialize gorm for postgres and sqlite databases.

Documentation

Index

Constants

View Source
const (
	Postgres = "postgres"
	Sqlite3  = "sqlite3"
)

Variables

This section is empty.

Functions

func New

func New(c CompletedConfig, logger *log.Helper) (*gorm.DB, error)

Types

type CompletedConfig

type CompletedConfig struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Options *Options
	DSN     string

	Postgres *postgres.Config
	SqlLite3 *sqlite3.Config
}

func NewConfig

func NewConfig(o *Options) *Config

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

type Options

type Options struct {
	Postgres           *postgres.Options `mapstructure:"postgres"`
	SqlLite3           *sqlite3.Options  `mapstructure:"sqlite3"`
	Database           string            `mapstructure:"database"`
	DisablePersistence bool              `mapstructure:"disable-persistence"`
}

func NewOptions

func NewOptions() *Options

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet, prefix string)

func (*Options) Complete

func (o *Options) Complete() []error

func (*Options) Validate

func (o *Options) Validate() []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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