store

package
v0.1.124 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MysqlGetVersion

func MysqlGetVersion(tx migration.LimitedTx) (int, error)

func MysqlSetVersion

func MysqlSetVersion(tx migration.LimitedTx, version int) error

Types

type Configuration

type Configuration struct {
	ID                string
	Name              string
	Value             string
	ParameterChecksum string
}

func (Configuration) StringifiedJSON

func (rv Configuration) StringifiedJSON() (string, error)

type Configurations

type Configurations []Configuration

func (Configurations) Len

func (c Configurations) Len() int

func (Configurations) Less

func (c Configurations) Less(i, j int) bool

func (Configurations) StringifiedJSON

func (c Configurations) StringifiedJSON() (string, error)

func (Configurations) Swap

func (c Configurations) Swap(i, j int)

type DBWrapper

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

func NewDbWrapper

func NewDbWrapper(db *sql.DB) DBWrapper

func (DBWrapper) Close

func (w DBWrapper) Close()

func (DBWrapper) Exec

func (w DBWrapper) Exec(query string, args ...interface{}) (sql.Result, error)

func (DBWrapper) Query

func (w DBWrapper) Query(query string, args ...interface{}) (IRows, error)

func (DBWrapper) QueryRow

func (w DBWrapper) QueryRow(query string, args ...interface{}) IRow

func (DBWrapper) SetMaxIdleConns

func (w DBWrapper) SetMaxIdleConns(n int)

func (DBWrapper) SetMaxOpenConns

func (w DBWrapper) SetMaxOpenConns(n int)

type DbProvider

type DbProvider interface {
	Db() (IDb, error)
}

func NewConcreteDbProvider

func NewConcreteDbProvider(sql ISql, config config.DBConfig) (DbProvider, error)

type IDb

type IDb interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (IRows, error)
	QueryRow(query string, args ...interface{}) IRow
	SetMaxOpenConns(n int)
	SetMaxIdleConns(n int)
	Close()
}

type IRow

type IRow interface {
	Scan(dest ...interface{}) error
}

type IRows

type IRows interface {
	Next() bool
	Close() error
	Scan(dest ...interface{}) error
}

type ISql

type ISql interface {
	OpenWith(
		driverName,
		dataSourceName string,
		migrations []migration.Migrator,
		getVersion migration.GetVersion,
		setVersion migration.SetVersion,
	) (IDb, error)
}

type MemoryStore

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

func (MemoryStore) Delete

func (store MemoryStore) Delete(name string) (int, error)

func (MemoryStore) GetByID

func (store MemoryStore) GetByID(id string) (Configuration, error)

func (MemoryStore) GetByName

func (store MemoryStore) GetByName(name string) (Configurations, error)

func (MemoryStore) Put

func (store MemoryStore) Put(name string, value string, checksum string) (string, error)

type RowWrapper

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

func NewRowWrapper

func NewRowWrapper(row *sql.Row) RowWrapper

func (RowWrapper) Scan

func (w RowWrapper) Scan(dest ...interface{}) error

type RowsWrapper

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

func NewRowsWrapper

func NewRowsWrapper(rows *sql.Rows) RowsWrapper

func (RowsWrapper) Close

func (w RowsWrapper) Close() error

func (RowsWrapper) Next

func (w RowsWrapper) Next() bool

func (RowsWrapper) Scan

func (w RowsWrapper) Scan(dest ...interface{}) error

type SQLWrapper

type SQLWrapper struct {
}

func NewSQLWrapper

func NewSQLWrapper() SQLWrapper

func (SQLWrapper) OpenWith

func (w SQLWrapper) OpenWith(
	driverName,
	dataSourceName string,
	migrations []migration.Migrator,
	versionGet migration.GetVersion,
	versionSet migration.SetVersion,
) (IDb, error)

type Store

type Store interface {
	Put(key string, value string, checksum string) (string, error)
	GetByName(name string) (Configurations, error)
	GetByID(id string) (Configuration, error)
	Delete(key string) (int, error)
}

func CreateStore

func CreateStore(config config.ServerConfig) (store Store, err error)

func NewMemoryStore

func NewMemoryStore() Store

func NewMysqlStore

func NewMysqlStore(dbProvider DbProvider) Store

func NewPostgresStore

func NewPostgresStore(dbProvider DbProvider) Store

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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