Documentation
¶
Index ¶
- func ContextWithStorage(ctx context.Context) context.Context
- func IsEmpty(err error) bool
- func RegisterCommonDialectImplementor(schema configure.Schema, dialect CommonDialect)
- func RegisterImplementor(mgr Manager)
- func RegisterSQLDialectImplementor(sql SQLDialect)
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- type CommonDialect
- type Manager
- type RedisOption
- type SQLDialect
- type SQLOption
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCommonDialectImplementor ¶
func RegisterCommonDialectImplementor(schema configure.Schema, dialect CommonDialect)
RegisterCommonDialectImplementor registers common storage Dialector.
func RegisterImplementor ¶
func RegisterImplementor(mgr Manager)
RegisterImplementor registers the storage manage service implementor.
func RegisterSQLDialectImplementor ¶
func RegisterSQLDialectImplementor(sql SQLDialect)
RegisterSQLDialectImplementor registers gorm sql Dialector.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for storage manager.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor for storage manager.
Types ¶
type CommonDialect ¶
func CommonDialectImplementor ¶
func CommonDialectImplementor(schema configure.Schema) CommonDialect
CommonDialectImplementor returns the common storage Dialector implementor.
type Manager ¶
func Implementor ¶
func Implementor() Manager
Implementor returns the storage manage service implementor.
type RedisOption ¶
type RedisOption func(*redis.Options)
func WithRedisIdleCheckFreq ¶
func WithRedisIdleCheckFreq(dur time.Duration) RedisOption
func WithRedisMaxConnAge ¶
func WithRedisMaxConnAge(dur time.Duration) RedisOption
func WithRedisMaxRetry ¶
func WithRedisMaxRetry(retries int) RedisOption
type SQLDialect ¶
func SQLDialectImplementor ¶
func SQLDialectImplementor() SQLDialect
SQLDialectImplementor returns the gorm sql Dialector implementor.
type SQLOption ¶
func WithDBConnMaxLifetime ¶
WithDBConnMaxLifetime sets the maximum amount of time a connection may be reused.
func WithDBMaxIdleConn ¶
WithDBMaxIdleConn sets the maximum number of connections in the idle connection pool.
func WithDBMaxOpenConn ¶
WithDBMaxOpenConn sets the maximum number of open connections to the database.
func WithoutDBAutomaticPing ¶
func WithoutDBAutomaticPing() SQLOption
WithoutDBAutomaticPing disables automatic ping.
func WithoutDBDefaultTransaction ¶
func WithoutDBDefaultTransaction() SQLOption
WithoutDBDefaultTransaction disables single create, update, delete operations in transaction.
type Storage ¶
type Storage interface { InitDB(master configure.Address, slaves []configure.Address, opts ...SQLOption) error InitRedis(configs []configure.Address, opts ...RedisOption) error GetDB(readOnly ...bool) *gorm.DB GetRedisz() []redis.Cmdable GetRedis(key interface{}) redis.Cmdable InitCommon(config configure.Address) error GetCommon(schema configure.Schema) interface{} }
Storage interface.