dao

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

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

Dao struct conf

func New

func New(c *conf.Config) (d *Dao)

New new dao

func (*Dao) AddCache

func (d *Dao) AddCache(f func())

AddCache add cache chan

func (*Dao) AllShorts

func (d *Dao) AllShorts(ctx context.Context) (res []*model.ShortUrl, err error)

AllShorts get all short_url

func (*Dao) Cache

func (d *Dao) Cache(c context.Context, short string) (su *model.ShortUrl, err error)

Cache get short url cache.

func (*Dao) Close

func (d *Dao) Close()

Close close db.

func (*Dao) InShort

func (d *Dao) InShort(ctx context.Context, su *model.ShortUrl) (id int64, err error)

InShort add short_url

func (*Dao) Ping

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

Ping ping dao

func (*Dao) PingMC

func (d *Dao) PingMC(c context.Context) (err error)

PingMC ping mc is ok.

func (*Dao) SetCache

func (d *Dao) SetCache(c context.Context, su *model.ShortUrl) (err error)

SetCache save model.ShortUrl to memcache

func (*Dao) SetEmptyCache

func (d *Dao) SetEmptyCache(c context.Context, short string) (err error)

SetEmptyCache set empty cache for a few time

func (*Dao) Short

func (d *Dao) Short(ctx context.Context, short string) (res *model.ShortUrl, err error)

Short get short_url

func (*Dao) ShortCount

func (d *Dao) ShortCount(ctx context.Context, mid int64, long string) (count int, err error)

ShortCount get all short_url

func (*Dao) ShortLimit

func (d *Dao) ShortLimit(ctx context.Context, pn, ps int, mid int64, long string) (res []*model.ShortUrl, err error)

ShortLimit get short_url list

func (*Dao) ShortUp

func (d *Dao) ShortUp(ctx context.Context, id, mid int64, long string) (rows int64, err error)

ShortUp add short_url

func (*Dao) ShortbyID

func (d *Dao) ShortbyID(ctx context.Context, id int64) (res *model.ShortUrl, err error)

ShortbyID get short_url by id

func (*Dao) UpdateState

func (d *Dao) UpdateState(ctx context.Context, id, mid int64, state int) (rows int64, err error)

UpdateState update state

Jump to

Keyboard shortcuts

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