beeorm

package module
v2.9.40 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 31 Imported by: 0

README

BeeORM

Golang ORM designed for optimal performance with MySQL and Redis

codecov Go Report Card MIT license

Official documentation

Documentation

Index

Constants

View Source
const DateFormat = "2006-01-02"
View Source
const LazyFlushChannelName = "orm-lazy-flush-stream"
View Source
const LazyFlushGroupName = "orm-lazy-flush-consumer"
View Source
const NullBindValue = "NULL"
View Source
const StreamGarbageCollectorChannelName = "orm-stream-garbage-collector-stream"
View Source
const StreamGarbageCollectorGroupName = "orm-garbage-collector-consumer"
View Source
const TimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func DisableCacheHashCheck

func DisableCacheHashCheck()

func RunLazyFlushConsumer

func RunLazyFlushConsumer(engine Engine, garbage bool)

func RunStreamGarbageCollectorConsumer

func RunStreamGarbageCollectorConsumer(engine Engine)

Types

type Alter

type Alter struct {
	SQL  string
	Safe bool
	Pool string
}

func (Alter) Exec

func (a Alter) Exec(engine Engine)

type Bind

type Bind map[string]string

func (Bind) Get

func (m Bind) Get(key string) string

type CachedQuery

type CachedQuery struct{}

type ColumnSchemaDefinition

type ColumnSchemaDefinition struct {
	ColumnName string
	Definition string
}

type DB

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

func (*DB) Begin

func (db *DB) Begin()

func (*DB) Commit

func (db *DB) Commit()

func (*DB) Exec

func (db *DB) Exec(query string, args ...interface{}) ExecResult

func (*DB) GetDBClient

func (db *DB) GetDBClient() DBClient

func (*DB) GetDBClientTX

func (db *DB) GetDBClientTX() DBClientTX

func (*DB) GetPoolConfig

func (db *DB) GetPoolConfig() MySQLPoolConfig

func (*DB) IsInTransaction

func (db *DB) IsInTransaction() bool

func (*DB) Prepare

func (db *DB) Prepare(query string) (stmt PreparedStmt, close func())

func (*DB) Query

func (db *DB) Query(query string, args ...interface{}) (rows Rows, close func())

func (*DB) QueryRow

func (db *DB) QueryRow(query *Where, toFill ...interface{}) (found bool)

func (*DB) Rollback

func (db *DB) Rollback()

func (*DB) SetMockClientTX

func (db *DB) SetMockClientTX(mock DBClientTX)

func (*DB) SetMockDBClient

func (db *DB) SetMockDBClient(mock DBClient)

type DBClient

type DBClient interface {
	DBClientQuery
	Begin() (*sql.Tx, error)
}

type DBClientQuery

type DBClientQuery interface {
	Prepare(query string) (*sql.Stmt, error)
	Exec(query string, args ...interface{}) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

type DBClientTX

type DBClientTX interface {
	DBClientQuery
	Commit() error
	Rollback() error
}

type DuplicatedKeyError

type DuplicatedKeyError struct {
	Message string
	Index   string
}

func (*DuplicatedKeyError) Error

func (err *DuplicatedKeyError) Error() string

type Engine

type Engine interface {
	Clone() Engine
	EnableRequestCache()
	GetMysql(code ...string) *DB
	GetLocalCache(code ...string) LocalCache
	GetRedis(code ...string) RedisCache
	IsDirty(entity Entity) bool
	GetDirtyBind(entity Entity) (bind Bind, has bool)
	NewFlusher() Flusher
	Flush(entity ...Entity)
	FlushLazy(entity ...Entity)
	FlushWithCheck(entity ...Entity) error
	FlushWithFullCheck(entity ...Entity) error
	Delete(entity ...Entity)
	DeleteLazy(entity ...Entity)
	GetRegistry() ValidatedRegistry
	SearchWithCount(where *Where, pager *Pager, entities interface{}, references ...string) (totalRows int)
	Search(where *Where, pager *Pager, entities interface{}, references ...string)
	SearchIDsWithCount(where *Where, pager *Pager, entity Entity) (results []uint64, totalRows int)
	SearchIDs(where *Where, pager *Pager, entity Entity) []uint64
	SearchOne(where *Where, entity Entity, references ...string) (found bool)
	CachedSearchOne(entity Entity, indexName string, arguments ...interface{}) (found bool)
	CachedSearchOneWithReferences(entity Entity, indexName string, arguments []interface{}, references []string) (found bool)
	CachedSearch(entities interface{}, indexName string, pager *Pager, arguments ...interface{}) (totalRows int)
	CachedSearchIDs(entity Entity, indexName string, pager *Pager, arguments ...interface{}) (totalRows int, ids []uint64)
	CachedSearchCount(entity Entity, indexName string, arguments ...interface{}) int
	CachedSearchWithReferences(entities interface{}, indexName string, pager *Pager, arguments []interface{}, references []string) (totalRows int)
	ClearCacheByIDs(entity Entity, ids ...uint64)
	LoadByID(id uint64, entity Entity, references ...string) (found bool)
	Load(entity Entity, references ...string) (found bool)
	LoadByIDs(ids []uint64, entities interface{}, references ...string) (found bool)
	GetAlters() (alters []Alter)
	GetEventBroker() EventBroker
	RegisterQueryLogger(handler LogHandler, mysql, redis, local bool)
	EnableQueryDebug()
	EnableQueryDebugCustom(mysql, redis, local bool)
	SetPluginOption(plugin, key string, value interface{})
	GetPluginOption(plugin, key string) interface{}
	SetMetaData(key, value string)
	GetMetaData() Bind
	HasRedisLogger() (bool, []LogHandler)
}

func PrepareTables

func PrepareTables(t *testing.T, registry *Registry, mySQLVersion, redisVersion int, redisNamespace string, entities ...Entity) (engine Engine)

type Entity

type Entity interface {
	GetID() uint64

	IsLoaded() bool
	SetOnDuplicateKeyUpdate(bind Bind)
	SetField(field string, value interface{}) error
	Clone() Entity
	SetMetaData(key, value string)
	GetMetaData() Bind
	// contains filtered or unexported methods
}

type EntitySchema

type EntitySchema interface {
	GetTableName() string
	GetEntityName() string
	GetType() reflect.Type
	NewEntity() Entity
	DropTable(engine Engine)
	TruncateTable(engine Engine)
	UpdateSchema(engine Engine)
	UpdateSchemaAndTruncateTable(engine Engine)
	GetMysql(engine Engine) *DB
	GetMysqlPool() string
	GetLocalCache(engine Engine) (cache LocalCache, has bool)
	GetRedisCache(engine Engine) (cache RedisCache, has bool)
	GetReferences() []EntitySchemaReference
	GetColumns() []string
	GetUniqueIndexes() map[string][]string
	GetSchemaChanges(engine Engine) (has bool, alters []Alter)
	GetUsage(registry ValidatedRegistry) map[reflect.Type][]string
	GetTag(field, key, trueValue, defaultValue string) string
	GetPluginOption(plugin, key string) interface{}
	DisableCache(local, redis bool)
}

type EntitySchemaReference

type EntitySchemaReference struct {
	ColumnName string
	FieldPath  []string
	EntityName string
}

type Enum

type Enum interface {
	GetFields() []string
	GetDefault() string
	Has(value string) bool
	Index(value string) int
}

type Event

type Event interface {
	Ack()
	ID() string
	Stream() string
	Meta() Bind
	Unserialize(val interface{})
	// contains filtered or unexported methods
}

type EventBroker

type EventBroker interface {
	Publish(stream string, body interface{}, meta Bind) (id string)
	Consumer(group string) EventsConsumer
	GetStreamsStatistics(stream ...string) []*RedisStreamStatistics
	GetStreamStatistics(stream string) *RedisStreamStatistics
	GetStreamGroupStatistics(stream, group string) *RedisStreamGroupStatistics
}

type EventConsumerHandler

type EventConsumerHandler func(events []Event)

type EventEntityFlushed

type EventEntityFlushed interface {
	Type() FlushType
	EntityName() string
	EntityID() uint64
	Before() Bind
	After() Bind
	MetaData() Bind
}

type EventEntityFlushing

type EventEntityFlushing interface {
	EventEntityFlushed
	SetID(id uint64)
	SetType(t FlushType)
	SetBefore(before Bind)
	SetAfter(before Bind)
	SetMetaData(key, value string)
	SetField(field, bind string, value interface{}) error
}

type EventsConsumer

type EventsConsumer interface {
	Consume(ctx context.Context, count int, handler EventConsumerHandler) bool
	ConsumeMany(ctx context.Context, nr, count int, handler EventConsumerHandler) bool
	Claim(from, to int)
	SetBlockTime(seconds int)
}

type ExecResult

type ExecResult interface {
	LastInsertId() uint64
	RowsAffected() uint64
}

type FlushType

type FlushType int
const (
	Insert FlushType = iota
	Update
	Delete
	InsertUpdate
)

func (FlushType) Is

func (ft FlushType) Is(target FlushType) bool

func (FlushType) String

func (ft FlushType) String() string

type Flusher

type Flusher interface {
	FlusherCacheSetter
	Track(entity ...Entity) Flusher
	Flush()
	FlushWithCheck() error
	FlushWithFullCheck() error
	FlushLazy()
	Clear()
	Delete(entity ...Entity) Flusher
}

type FlusherCacheSetter

type FlusherCacheSetter interface {
	GetLocalCacheSetter(code ...string) LocalCacheSetter
	GetRedisCacheSetter(code ...string) RedisCacheSetter
	PublishToStream(stream string, body interface{}, meta Bind)
}

type IndexSchemaDefinition

type IndexSchemaDefinition struct {
	Name   string
	Unique bool
	// contains filtered or unexported fields
}

func (*IndexSchemaDefinition) GetColumns

func (ti *IndexSchemaDefinition) GetColumns() []string

func (*IndexSchemaDefinition) SetColumns

func (ti *IndexSchemaDefinition) SetColumns(columns []string)

type LazyFlushConsumer

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

func NewLazyFlushConsumer

func NewLazyFlushConsumer(engine Engine) *LazyFlushConsumer

func (*LazyFlushConsumer) Digest

func (r *LazyFlushConsumer) Digest(ctx context.Context) bool

func (*LazyFlushConsumer) RegisterLazyFlushQueryErrorResolver

func (r *LazyFlushConsumer) RegisterLazyFlushQueryErrorResolver(resolver LazyFlushQueryErrorResolver)

func (*LazyFlushConsumer) SetBlockTime

func (b *LazyFlushConsumer) SetBlockTime(seconds int)

type LazyFlushQueryErrorResolver

type LazyFlushQueryErrorResolver func(engine Engine, event EventEntityFlushed, queryError *mysql.MySQLError) error

type LocalCache

type LocalCache interface {
	LocalCacheSetter
	GetPoolConfig() LocalCachePoolConfig
	GetSet(key string, ttl time.Duration, provider func() interface{}) interface{}
	Get(key string) (value interface{}, ok bool)
	MGet(keys ...string) []interface{}
	Clear()
	GetObjectsCount() int
}

type LocalCachePoolConfig

type LocalCachePoolConfig interface {
	GetCode() string
	GetLimit() int
}

type LocalCacheSetter

type LocalCacheSetter interface {
	Set(key string, value interface{})
	MSet(pairs ...interface{})
	Remove(keys ...string)
}

type Lock

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

func (*Lock) Refresh

func (l *Lock) Refresh(ctx context.Context, ttl time.Duration) bool

func (*Lock) Release

func (l *Lock) Release()

func (*Lock) TTL

func (l *Lock) TTL(ctx context.Context) time.Duration

type Locker

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

func (*Locker) Obtain

func (l *Locker) Obtain(ctx context.Context, key string, ttl time.Duration, waitTimeout time.Duration) (lock *Lock, obtained bool)

type LogHandler

type LogHandler interface {
	Handle(engine Engine, log map[string]interface{})
}

type MockDBClient

type MockDBClient struct {
	OriginDB            DBClient
	TX                  DBClientTX
	PrepareMock         func(query string) (*sql.Stmt, error)
	ExecMock            func(query string, args ...interface{}) (sql.Result, error)
	ExecContextMock     func(context context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowMock        func(query string, args ...interface{}) *sql.Row
	QueryRowContextMock func(ctx context.Context, query string, args ...interface{}) *sql.Row
	QueryMock           func(query string, args ...interface{}) (*sql.Rows, error)
	QueryContextMock    func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	BeginMock           func() (*sql.Tx, error)
	CommitMock          func() error
	RollbackMock        func() error
}

func (*MockDBClient) Begin

func (m *MockDBClient) Begin() (*sql.Tx, error)

func (*MockDBClient) Commit

func (m *MockDBClient) Commit() error

func (*MockDBClient) Exec

func (m *MockDBClient) Exec(query string, args ...interface{}) (sql.Result, error)

func (*MockDBClient) ExecContext

func (m *MockDBClient) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*MockDBClient) Prepare

func (m *MockDBClient) Prepare(query string) (*sql.Stmt, error)

func (*MockDBClient) Query

func (m *MockDBClient) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*MockDBClient) QueryContext

func (m *MockDBClient) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*MockDBClient) QueryRow

func (m *MockDBClient) QueryRow(query string, args ...interface{}) *sql.Row

func (*MockDBClient) QueryRowContext

func (m *MockDBClient) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

func (*MockDBClient) Rollback

func (m *MockDBClient) Rollback() error

type MockLogHandler

type MockLogHandler struct {
	Logs []map[string]interface{}
}

func (*MockLogHandler) Clear

func (h *MockLogHandler) Clear()

func (*MockLogHandler) Handle

func (h *MockLogHandler) Handle(_ Engine, log map[string]interface{})

type MySQLPoolConfig

type MySQLPoolConfig interface {
	GetCode() string
	GetDatabase() string
	GetDataSourceURI() string
	GetVersion() int
	// contains filtered or unexported methods
}

type MySQLPoolOptions

type MySQLPoolOptions struct {
	ConnMaxLifetime    time.Duration
	MaxOpenConnections int
	MaxIdleConnections int
}

type ORM

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

func (*ORM) Clone

func (orm *ORM) Clone() Entity

func (*ORM) GetID

func (orm *ORM) GetID() uint64

func (*ORM) GetMetaData

func (orm *ORM) GetMetaData() Bind

func (*ORM) IsLoaded

func (orm *ORM) IsLoaded() bool

func (*ORM) SetField

func (orm *ORM) SetField(field string, value interface{}) error

func (*ORM) SetMetaData

func (orm *ORM) SetMetaData(key, value string)

func (*ORM) SetOnDuplicateKeyUpdate

func (orm *ORM) SetOnDuplicateKeyUpdate(bind Bind)

type Pager

type Pager struct {
	// CurrentPage is the current page number.
	CurrentPage int

	// PageSize is the number of items per page.
	PageSize int
}

Pager represents a paginated list of results.

func NewPager

func NewPager(currentPage, pageSize int) *Pager

NewPager creates a new Pager with the given page number and page size.

func (*Pager) GetCurrentPage

func (pager *Pager) GetCurrentPage() int

GetCurrentPage returns the current page number of the Pager.

func (*Pager) GetPageSize

func (pager *Pager) GetPageSize() int

GetPageSize returns the page size of the Pager.

func (*Pager) IncrementPage

func (pager *Pager) IncrementPage()

IncrementPage increments the current page number of the Pager.

func (*Pager) String

func (pager *Pager) String() string

String returns SQL 'LIMIT X,Y'.

type PipeLineBool

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

func (*PipeLineBool) Result

func (c *PipeLineBool) Result() bool

type PipeLineGet

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

func (*PipeLineGet) Result

func (c *PipeLineGet) Result() (value string, has bool)

type PipeLineInt

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

func (*PipeLineInt) Result

func (c *PipeLineInt) Result() int64

type PipeLineString

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

func (*PipeLineString) Result

func (c *PipeLineString) Result() string

type Plugin

type Plugin interface {
	GetCode() string
}

type PluginInterfaceEngineCreated

type PluginInterfaceEngineCreated interface {
	PluginInterfaceEngineCreated(engine Engine)
}

type PluginInterfaceEntityFlushed

type PluginInterfaceEntityFlushed interface {
	PluginInterfaceEntityFlushed(engine Engine, event EventEntityFlushed, cacheFlusher FlusherCacheSetter)
}

type PluginInterfaceEntityFlushing

type PluginInterfaceEntityFlushing interface {
	PluginInterfaceEntityFlushing(engine Engine, event EventEntityFlushing)
}

type PluginInterfaceEntitySearch

type PluginInterfaceEntitySearch interface {
	PluginInterfaceEntitySearch(engine Engine, schema EntitySchema, where *Where) *Where
}

type PluginInterfaceInitEntitySchema

type PluginInterfaceInitEntitySchema interface {
	InterfaceInitEntitySchema(schema SettableEntitySchema, registry *Registry) error
}

type PluginInterfaceInitRegistry

type PluginInterfaceInitRegistry interface {
	PluginInterfaceInitRegistry(registry *Registry)
}

type PluginInterfaceTableSQLSchemaDefinition

type PluginInterfaceTableSQLSchemaDefinition interface {
	PluginInterfaceTableSQLSchemaDefinition(engine Engine, sqlSchema *TableSQLSchemaDefinition) error
}

type PreparedStmt

type PreparedStmt interface {
	Exec(args ...any) ExecResult
	Query(args ...any) (rows Rows, close func())
	QueryRow(args []interface{}, toFill ...interface{}) (found bool)
	Close() error
}

type QueryLoggerSource

type QueryLoggerSource int

type RedisCache

type RedisCache interface {
	RedisCacheSetter
	GetSet(key string, expiration time.Duration, provider func() interface{}) interface{}
	PipeLine() *RedisPipeLine
	Info(section ...string) string
	GetPoolConfig() RedisPoolConfig
	Get(key string) (value string, has bool)
	Eval(script string, keys []string, args ...interface{}) interface{}
	EvalSha(sha1 string, keys []string, args ...interface{}) (res interface{}, exists bool)
	SetNX(key string, value interface{}, expiration time.Duration) bool
	ScriptExists(sha1 string) bool
	ScriptLoad(script string) string
	LPush(key string, values ...interface{}) int64
	RPush(key string, values ...interface{}) int64
	LLen(key string) int64
	Exists(keys ...string) int64
	Type(key string) string
	LRange(key string, start, stop int64) []string
	LSet(key string, index int64, value interface{})
	RPop(key string) (value string, found bool)
	LRem(key string, count int64, value interface{})
	Ltrim(key string, start, stop int64)
	HSetNx(key, field string, value interface{}) bool
	HDel(key string, fields ...string)
	HMGet(key string, fields ...string) map[string]interface{}
	HGetAll(key string) map[string]string
	HGet(key, field string) (value string, has bool)
	HLen(key string) int64
	HIncrBy(key, field string, incr int64) int64
	IncrBy(key string, incr int64) int64
	Incr(key string) int64
	IncrWithExpire(key string, expire time.Duration) int64
	Expire(key string, expiration time.Duration) bool
	ZAdd(key string, members ...redis.Z) int64
	ZRevRange(key string, start, stop int64) []string
	ZRevRangeWithScores(key string, start, stop int64) []redis.Z
	ZRangeWithScores(key string, start, stop int64) []redis.Z
	ZCard(key string) int64
	ZCount(key string, min, max string) int64
	ZScore(key, member string) float64
	MGet(keys ...string) []interface{}
	SAdd(key string, members ...interface{}) int64
	SCard(key string) int64
	SPop(key string) (string, bool)
	SPopN(key string, max int64) []string
	XTrim(stream string, maxLen int64) (deleted int64)
	XRange(stream, start, stop string, count int64) []redis.XMessage
	XRevRange(stream, start, stop string, count int64) []redis.XMessage
	XInfoStream(stream string) *redis.XInfoStream
	XInfoGroups(stream string) []redis.XInfoGroup
	XGroupCreate(stream, group, start string) (key string, exists bool)
	XGroupCreateMkStream(stream, group, start string) (key string, exists bool)
	XGroupDestroy(stream, group string) int64
	XRead(a *redis.XReadArgs) []redis.XStream
	XDel(stream string, ids ...string) int64
	XGroupDelConsumer(stream, group, consumer string) int64
	XReadGroup(ctx context.Context, a *redis.XReadGroupArgs) (streams []redis.XStream)
	XPending(stream, group string) *redis.XPending
	XPendingExt(a *redis.XPendingExtArgs) []redis.XPendingExt
	XLen(stream string) int64
	XClaim(a *redis.XClaimArgs) []redis.XMessage
	XClaimJustID(a *redis.XClaimArgs) []string
	XAck(stream, group string, ids ...string) int64
	FlushAll()
	FlushDB()
	GetLocker() *Locker
	Process(ctx context.Context, cmd redis.Cmder) error
	HasNamespace() bool
	GetNamespace() string
	GetCode() string
	RemoveNamespacePrefix(key string) string
	AddNamespacePrefix(key string) string
}

type RedisCacheSetter

type RedisCacheSetter interface {
	Set(key string, value interface{}, expiration time.Duration)
	MSet(pairs ...interface{})
	Del(keys ...string)

	HSet(key string, values ...interface{})
	// contains filtered or unexported methods
}

type RedisPipeLine

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

func (*RedisPipeLine) Del

func (rp *RedisPipeLine) Del(key ...string)

func (*RedisPipeLine) Exec

func (rp *RedisPipeLine) Exec()

func (*RedisPipeLine) Expire

func (rp *RedisPipeLine) Expire(key string, expiration time.Duration) *PipeLineBool

func (*RedisPipeLine) Get

func (rp *RedisPipeLine) Get(key string) *PipeLineGet

func (*RedisPipeLine) HDel

func (rp *RedisPipeLine) HDel(key string, values ...string)

func (*RedisPipeLine) HIncrBy

func (rp *RedisPipeLine) HIncrBy(key, field string, incr int64) *PipeLineInt

func (*RedisPipeLine) HSet

func (rp *RedisPipeLine) HSet(key string, values ...interface{})

func (*RedisPipeLine) MSet

func (rp *RedisPipeLine) MSet(pairs ...interface{})

func (*RedisPipeLine) Set

func (rp *RedisPipeLine) Set(key string, value interface{}, expiration time.Duration)

func (*RedisPipeLine) XAdd

func (rp *RedisPipeLine) XAdd(stream string, values []string) *PipeLineString

type RedisPoolConfig

type RedisPoolConfig interface {
	GetCode() string
	GetDatabase() int
	GetAddress() string
	GetNamespace() string
	HasNamespace() bool
	// contains filtered or unexported methods
}

type RedisStreamConsumerStatistics

type RedisStreamConsumerStatistics struct {
	Name    string
	Pending uint64
}

type RedisStreamGroupStatistics

type RedisStreamGroupStatistics struct {
	Group                 string
	Lag                   int64
	Pending               uint64
	LastDeliveredID       string
	LastDeliveredDuration time.Duration
	LowerID               string
	LowerDuration         time.Duration
	Consumers             []*RedisStreamConsumerStatistics
}

type RedisStreamStatistics

type RedisStreamStatistics struct {
	Stream             string
	RedisPool          string
	Len                uint64
	OldestEventSeconds int
	Groups             []*RedisStreamGroupStatistics
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) GetDefaultCollate

func (r *Registry) GetDefaultCollate() string

func (*Registry) HasRegisteredRedisPool added in v2.9.6

func (r *Registry) HasRegisteredRedisPool(pool string) bool

func (*Registry) InitByYaml

func (r *Registry) InitByYaml(yaml map[string]interface{})

func (*Registry) RegisterEntity

func (r *Registry) RegisterEntity(entity ...Entity)

func (*Registry) RegisterEnum

func (r *Registry) RegisterEnum(code string, values []string, defaultValue ...string)

func (*Registry) RegisterEnumStruct

func (r *Registry) RegisterEnumStruct(code string, val interface{}, defaultValue ...string)

func (*Registry) RegisterLocalCache

func (r *Registry) RegisterLocalCache(size int, code ...string)

func (*Registry) RegisterMySQLPool

func (r *Registry) RegisterMySQLPool(dataSourceName string, poolOptions MySQLPoolOptions, code ...string)

func (*Registry) RegisterMySQLTable

func (r *Registry) RegisterMySQLTable(pool string, tableName ...string)

func (*Registry) RegisterPlugin

func (r *Registry) RegisterPlugin(plugin Plugin)

func (*Registry) RegisterRedis

func (r *Registry) RegisterRedis(address, namespace string, db int, code ...string)

func (*Registry) RegisterRedisSentinel

func (r *Registry) RegisterRedisSentinel(masterName, namespace string, db int, sentinels []string, code ...string)

func (*Registry) RegisterRedisSentinelWithCredentials

func (r *Registry) RegisterRedisSentinelWithCredentials(masterName, namespace, user, password string, db int, sentinels []string, code ...string)

func (*Registry) RegisterRedisSentinelWithOptions

func (r *Registry) RegisterRedisSentinelWithOptions(namespace string, opts redis.FailoverOptions, db int, sentinels []string, code ...string)

func (*Registry) RegisterRedisStream

func (r *Registry) RegisterRedisStream(name string, redisPool string)

func (*Registry) RegisterRedisStreamConsumerGroups

func (r *Registry) RegisterRedisStreamConsumerGroups(stream string, groups ...string)

func (*Registry) RegisterRedisWithCredentials

func (r *Registry) RegisterRedisWithCredentials(address, namespace, user, password string, db int, code ...string)

func (*Registry) SetDefaultCollate

func (r *Registry) SetDefaultCollate(collate string)

func (*Registry) SetDefaultEncoding

func (r *Registry) SetDefaultEncoding(encoding string)

func (*Registry) Validate

func (r *Registry) Validate() (validated ValidatedRegistry, err error)

type Rows

type Rows interface {
	Next() bool
	Scan(dest ...interface{})
	Columns() []string
}

type SQLRow

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

type SQLRows

type SQLRows interface {
	Next() bool
	Err() error
	Close() error
	Scan(dest ...interface{}) error
	Columns() ([]string, error)
}

type SettableEntitySchema

type SettableEntitySchema interface {
	EntitySchema
	SetPluginOption(plugin, key string, value interface{})
}

type StreamGarbageCollectorConsumer

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

func NewStreamGarbageCollectorConsumer

func NewStreamGarbageCollectorConsumer(engine Engine) *StreamGarbageCollectorConsumer

func (*StreamGarbageCollectorConsumer) Digest

func (*StreamGarbageCollectorConsumer) SetBlockTime

func (b *StreamGarbageCollectorConsumer) SetBlockTime(seconds int)

type TableSQLSchemaDefinition

type TableSQLSchemaDefinition struct {
	EntitySchema   EntitySchema
	EntityColumns  []*ColumnSchemaDefinition
	EntityIndexes  []*IndexSchemaDefinition
	DBTableColumns []*ColumnSchemaDefinition
	DBIndexes      []*IndexSchemaDefinition
	DBCreateSchema string
	DBEncoding     string
	PreAlters      []Alter
	PostAlters     []Alter
	// contains filtered or unexported fields
}

func (*TableSQLSchemaDefinition) CreateTableSQL

func (td *TableSQLSchemaDefinition) CreateTableSQL() string

type ValidatedRegistry

type ValidatedRegistry interface {
	CreateEngine() Engine
	GetEntitySchema(entityName string) EntitySchema
	GetEntitySchemaForEntity(entity Entity) EntitySchema
	GetEntitySchemaForCachePrefix(cachePrefix string) EntitySchema
	GetSourceRegistry() *Registry
	GetEnum(code string) Enum
	GetRedisStreams() map[string]map[string][]string
	GetMySQLPools() map[string]MySQLPoolConfig
	GetLocalCachePools() map[string]LocalCachePoolConfig
	GetRedisPools() map[string]RedisPoolConfig
	GetEntities() map[string]reflect.Type
	GetPlugins() []string
	GetPlugin(code string) Plugin
}

type Where

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

func NewWhere

func NewWhere(query string, parameters ...interface{}) *Where

func (*Where) Append

func (where *Where) Append(query string, parameters ...interface{})

func (*Where) GetParameters

func (where *Where) GetParameters() []interface{}

func (*Where) SetParameter

func (where *Where) SetParameter(index int, param interface{}) *Where

func (*Where) SetParameters

func (where *Where) SetParameters(params ...interface{}) *Where

func (*Where) String

func (where *Where) String() string

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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