dao

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MidFmt = "%s:%v" // {appId}:{uid}

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

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

Dao dao.

func New

func New(c *conf.Config) *Dao

New new a dao and return.

func (*Dao) AddMapping

func (d *Dao) AddMapping(c context.Context, mid string, appId string, key string, server string) (err error)

func (*Dao) Close

func (d *Dao) Close() error

Close close the resource.

func (*Dao) DecGroupServer

func (d *Dao) DecGroupServer(c context.Context, appId, key, server string, gid []string) (err error)

func (*Dao) DelMapping

func (d *Dao) DelMapping(c context.Context, mid string, appId string, key string) (has bool, err error)

func (*Dao) ExpireMapping

func (d *Dao) ExpireMapping(c context.Context, mid string, appId string, key string) (has bool, err error)

ExpireMapping expire a mapping.

func (*Dao) GetMember

func (d *Dao) GetMember(c context.Context, key string) (appId string, mid string, err error)

func (*Dao) GetServer

func (d *Dao) GetServer(c context.Context, key string) (server string, err error)

func (*Dao) IncGroupServer

func (d *Dao) IncGroupServer(c context.Context, appId, key, server string, gid []string) (err error)

groups

func (*Dao) KeysByMids

func (d *Dao) KeysByMids(c context.Context, appId string, mids []string) (ress map[string]string, olMids []string, err error)

KeysByMids get a key server by mid.

func (*Dao) Ping

func (d *Dao) Ping(c context.Context) error

Ping dao ping.

func (*Dao) PublishMsg

func (d *Dao) PublishMsg(ctx context.Context, appId string, fromId string, op comet.Op, key string, msg []byte) (err error)

PushMsg push a message to databus.

func (*Dao) ServersByGid

func (d *Dao) ServersByGid(c context.Context, appId string, gid string) (res []string, err error)

KeysByMids get a key server by mid.

func (*Dao) ServersByKeys

func (d *Dao) ServersByKeys(c context.Context, keys []string) (res []string, err error)

ServersByKeys get a server by key.

Jump to

Keyboard shortcuts

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