ndb

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewDB

func MustNewDB(dbConfig *nconf.DbConfig, opt ...DBOption) *gorm.DB

MustNewDB -

func NewDB

func NewDB(dbConfig *nconf.DbConfig, opt ...DBOption) (*gorm.DB, error)

NewDB -

Types

type DBOper added in v0.2.1

type DBOper interface {
	DB(ctx context.Context) *gorm.DB
	Transactional(ctx context.Context, fn func(ctx context.Context) error) error
}

DBOper -

func NewDBOper added in v0.2.1

func NewDBOper(db *gorm.DB) DBOper

NewDBOper -

type DBOption added in v0.2.3

type DBOption func(*dbOptions)

DBOption -

func DialectorOption added in v0.2.3

func DialectorOption(dialector gorm.Dialector) DBOption

DialectorOption -

type RedisOper

type RedisOper interface {
	// Conn - Get a redis connection from the pool.
	// The application must close the returned connection.
	Conn() redis.Conn
	GetString(key string) (string, error)
	SetString(key, value string) error
	SetStringOpts(key, value string, setnx bool, setxx bool, ttl time.Duration) error

	GetObject(key string, model interface{}) (interface{}, error)
	SetObject(key string, value interface{}) error
	SetObjectOpts(key string, value interface{}, setnx bool, setxx bool, ttl time.Duration) error

	Unlink(key string) error
	Unlinks(keys ...string) error

	Delete(key string) error
	Deletes(keys ...string) error
	DeleteByKeyValue(key string, val string) error
}

RedisOper -

func NewRedisOper

func NewRedisOper(redisPool RedisPool) RedisOper

NewRedisOper -

type RedisPool

type RedisPool interface {
	Get() redis.Conn
	Close() error
}

RedisPool -

func MustNewRedisPool

func MustNewRedisPool(redisConfig *nconf.RedisConfig) RedisPool

MustNewRedisPool -

func NewRedisPool

func NewRedisPool(redisConfig *nconf.RedisConfig) (RedisPool, error)

NewRedisPool -

type Transactional

type Transactional func(ctx context.Context, fn func(ctx context.Context) error) error

Transactional -

Jump to

Keyboard shortcuts

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