sandbox

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContainerNotFound = errors.New("container not found")

Functions

func ImitatorSql

func ImitatorSql[ID constraints.Ordered, T any](
	entities map[ID]*T,
	where []*expression.Where,
	groupBy []*expression.GroupBy,
	orderBy []*expression.OrderBy,
) ([]*T, error)

func ImitatorSqlOrderBy

func ImitatorSqlOrderBy(entities []*ImitatorModel, expressions ...*expression.OrderBy) (err error)

func Merge

func Merge(entity interface{}, values map[string]interface{}) error

func NewStubVault

func NewStubVault(d internal.Dialect, db internal.Vault, id int64, c ...io.Closer) internal.Vault

Types

type Container

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

func RunMySqlContainer

func RunMySqlContainer(port int, userLogin, userPassword, databaseName string) (*Container, error)

func RunPostgreSqlContainer

func RunPostgreSqlContainer(port int, userLogin, userPassword, databaseName string) (*Container, error)

func RunTestContainer

func RunTestContainer(image string, ports []string, env map[string]string, waitPorts ...string) (tc *Container, err error)

func (*Container) Close

func (tc *Container) Close() error

func (*Container) Dialect

func (tc *Container) Dialect() internal.Dialect

func (*Container) MappedHostPort

func (tc *Container) MappedHostPort(port string) (string, string, error)

func (*Container) NewConnection

func (tc *Container) NewConnection() (internal.Vault, error)

type ImitatorModel

type ImitatorModel map[string]interface{}

func ImitatorSqlGroupBy

func ImitatorSqlGroupBy(entities []*ImitatorModel, expressions ...*expression.GroupBy) ([]*ImitatorModel, error)

func ImitatorSqlWhere

func ImitatorSqlWhere(entities []*ImitatorModel, expressions ...*expression.Where) ([]*ImitatorModel, error)

func RecognizeImitatorModel

func RecognizeImitatorModel(entity interface{}) (*ImitatorModel, error)

func (*ImitatorModel) Compare

func (m *ImitatorModel) Compare(operator expression.Operator, table, column string, expected interface{}) (bool, error)

func (*ImitatorModel) GetValue

func (m *ImitatorModel) GetValue(table string, column string) (interface{}, bool)

type Pool

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

func NewPool

func NewPool() *Pool

func (*Pool) Close

func (p *Pool) Close() error

func (*Pool) NewMySQL

func (p *Pool) NewMySQL(port int, options ...string) (internal.Vault, error)

func (*Pool) NewPostgreSQL

func (p *Pool) NewPostgreSQL(port int, options ...string) (internal.Vault, error)

func (*Pool) NewSQLite3

func (p *Pool) NewSQLite3() (internal.Vault, error)

Jump to

Keyboard shortcuts

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