db

package
v0.0.0-...-021ab65 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbUserName string
	DbPassWord string
	DbAddr     string
	DbName     string
)

Functions

func AcquireLock

func AcquireLock(ctx context.Context, client *redis.Client, key string, value string, expiration time.Duration) (bool, error)

func GetLock

func GetLock(ctx context.Context, client *redis.Client, key string, value string, expiration time.Duration) (bool, error)

func InitMysqlConnect

func InitMysqlConnect()

func InitRdsClient

func InitRdsClient(addr, pwd string) *redis.Client

func NewMongoDBInstance

func NewMongoDBInstance(config *MongodbConfig) (*mongo.Client, error)

func ReleaseLock

func ReleaseLock(ctx context.Context, client *redis.Client, key string) (bool, error)

Types

type MongodbConfig

type MongodbConfig struct {
	URI    string `json:"uri"`
	DBName string `json:"db_name"`
}

type RedisConfig

type RedisConfig struct {
	Host string
	Type string
	Pass string
}

type SliceString

type SliceString []string

func NewSliceString

func NewSliceString(v []string) *SliceString

func (*SliceString) Get

func (d *SliceString) Get() []string

func (*SliceString) MarshalBinary

func (d *SliceString) MarshalBinary() (data []byte, err error)

func (*SliceString) MarshalText

func (d *SliceString) MarshalText() (text []byte, err error)

func (*SliceString) UnmarshalBinary

func (d *SliceString) UnmarshalBinary(v []byte) error

func (*SliceString) UnmarshalText

func (d *SliceString) UnmarshalText(v []byte) error

type TestTable

type TestTable struct {
}

Jump to

Keyboard shortcuts

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