redis

package
v0.0.0-...-e67e6ae Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MYSQL_DB               = `CREATE DATABASE IF NOT EXISTS iot_manage`
	MYSQL_IOT_THING_CREATE = `` /* 975-byte string literal not displayed */

	MYSQL_IOT_DEVICE_EVENT_DATA = `` /* 477-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func NewEventDB

func NewEventDB(urls []string) (event types.DBImpl, err error)

func NewPropertyDB

func NewPropertyDB(dbName, table string, urls []string, log *zap.Logger) (property types.DBImpl, err error)

Types

type EventDB

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

property model

func (*EventDB) BatchCreate

func (e *EventDB) BatchCreate(ctx context.Context, sqlCreate string, values interface{}) (err error)

func (*EventDB) Close

func (e *EventDB) Close() error

type LoadBalance

type LoadBalance interface {
	//选择一个后端Server
	//参数remove是需要排除选择的后端Server
	Select(remove []*redis.Client) *Server
	//更新可用Server列表
	UpdateServers(servers []*Server)
	Close()
}

type LoadBalanceRandom

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

func NewLoadBalanceRandom

func NewLoadBalanceRandom(servers []*Server) *LoadBalanceRandom

func (*LoadBalanceRandom) Close

func (l *LoadBalanceRandom) Close()

func (*LoadBalanceRandom) Select

func (l *LoadBalanceRandom) Select(remove []*redis.Client) *Server

选择一个后端Server

func (*LoadBalanceRandom) String

func (l *LoadBalanceRandom) String() string

func (*LoadBalanceRandom) UpdateServers

func (l *LoadBalanceRandom) UpdateServers(servers []*Server)

系统运行过程中,后端可用Server会更新

type PropertyDB

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

property model

func (*PropertyDB) BatchCreate

func (p *PropertyDB) BatchCreate(ctx context.Context, sqlCreate string, values interface{}) (err error)

func (*PropertyDB) Close

func (p *PropertyDB) Close() error

type Server

type Server struct {
	DB     *redis.Client
	Name   string
	Weight int
}

Jump to

Keyboard shortcuts

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