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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMapData

func InitMapData(fields []string) (item model.MapData, row []interface{})

InitMapData init each field struct

func UpdateOffsetByMap

func UpdateOffsetByMap(offsets *model.LoopOffset, mapData ...model.MapData)

UpdateOffsetByMap .

Types

type App

type App interface {
	Business() string
	InitIndex(c context.Context)
	InitOffset(c context.Context)
	Offset(c context.Context)
	SetRecover(c context.Context, recoverID int64, recoverTime string, i int)
	IncrMessages(c context.Context) (length int, err error)
	AllMessages(c context.Context) (length int, err error)
	BulkIndex(c context.Context, start, end int, writeEntityIndex bool) (err error)
	Commit(c context.Context) (err error)
	Sleep(c context.Context)
	Size(c context.Context) (size int)
}

App .

type AppDatabus

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

AppDatabus single table consume databus.

func NewAppDatabus

func NewAppDatabus(d *Dao, appid string) (a *AppDatabus)

NewAppDatabus .

func (*AppDatabus) AllMessages

func (a *AppDatabus) AllMessages(c context.Context) (length int, err error)

AllMessages .

func (*AppDatabus) BulkIndex

func (a *AppDatabus) BulkIndex(c context.Context, start, end int, writeEntityIndex bool) (err error)

BulkIndex .

func (*AppDatabus) Business

func (a *AppDatabus) Business() string

Business return business.

func (*AppDatabus) Commit

func (a *AppDatabus) Commit(c context.Context) (err error)

Commit commit offset.

func (*AppDatabus) IncrMessages

func (a *AppDatabus) IncrMessages(c context.Context) (length int, err error)

IncrMessages .

func (*AppDatabus) InitIndex

func (a *AppDatabus) InitIndex(c context.Context)

InitIndex init index.

func (*AppDatabus) InitOffset

func (a *AppDatabus) InitOffset(c context.Context)

InitOffset insert init value to offset.

func (*AppDatabus) Offset

func (a *AppDatabus) Offset(c context.Context)

Offset get offset.

func (*AppDatabus) SetRecover

func (a *AppDatabus) SetRecover(c context.Context, recoverID int64, recoverTime string, i int)

SetRecover set recover

func (*AppDatabus) Size

func (a *AppDatabus) Size(c context.Context) int

Size return size.

func (*AppDatabus) Sleep

func (a *AppDatabus) Sleep(c context.Context)

Sleep interval duration.

type AppMultiple

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

AppMultiple .

func NewAppMultiple

func NewAppMultiple(d *Dao, appid string) (am *AppMultiple)

NewAppMultiple .

func (*AppMultiple) AllMessages

func (am *AppMultiple) AllMessages(c context.Context) (length int, err error)

AllMessages .

func (*AppMultiple) BulkIndex

func (am *AppMultiple) BulkIndex(c context.Context, start int, end int, writeEntityIndex bool) (err error)

BulkIndex .

func (*AppMultiple) Business

func (am *AppMultiple) Business() string

Business return business

func (*AppMultiple) Commit

func (am *AppMultiple) Commit(c context.Context) (err error)

Commit .

func (*AppMultiple) IncrMessages

func (am *AppMultiple) IncrMessages(c context.Context) (length int, err error)

IncrMessages .

func (*AppMultiple) InitIndex

func (am *AppMultiple) InitIndex(c context.Context)

InitIndex .

func (*AppMultiple) InitOffset

func (am *AppMultiple) InitOffset(c context.Context)

InitOffset insert init value to offset.

func (*AppMultiple) Offset

func (am *AppMultiple) Offset(c context.Context)

Offset .

func (*AppMultiple) SetRecover

func (am *AppMultiple) SetRecover(c context.Context, recoverID int64, recoverTime string, i int)

SetRecover set recover

func (*AppMultiple) Size

func (am *AppMultiple) Size(c context.Context) (size int)

Size .

func (*AppMultiple) Sleep

func (am *AppMultiple) Sleep(c context.Context)

Sleep .

type AppMultipleDatabus

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

AppMultipleDatabus .

func NewAppMultipleDatabus

func NewAppMultipleDatabus(d *Dao, appid string) (amd *AppMultipleDatabus)

NewAppMultipleDatabus .

func (*AppMultipleDatabus) AllMessages

func (amd *AppMultipleDatabus) AllMessages(c context.Context) (length int, err error)

AllMessages .

func (*AppMultipleDatabus) BulkIndex

func (amd *AppMultipleDatabus) BulkIndex(c context.Context, start int, end int, writeEntityIndex bool) (err error)

BulkIndex .

func (*AppMultipleDatabus) Business

func (amd *AppMultipleDatabus) Business() string

Business return business.

func (*AppMultipleDatabus) Commit

func (amd *AppMultipleDatabus) Commit(c context.Context) (err error)

Commit .

func (*AppMultipleDatabus) IncrMessages

func (amd *AppMultipleDatabus) IncrMessages(c context.Context) (length int, err error)

IncrMessages .

func (*AppMultipleDatabus) IndexNameSuffix

func (amd *AppMultipleDatabus) IndexNameSuffix(format string, startDate string) (res []string, err error)

IndexNameSuffix .

func (*AppMultipleDatabus) InitIndex

func (amd *AppMultipleDatabus) InitIndex(c context.Context)

InitIndex .

func (*AppMultipleDatabus) InitOffset

func (amd *AppMultipleDatabus) InitOffset(c context.Context)

InitOffset insert init value to offset.

func (*AppMultipleDatabus) Offset

func (amd *AppMultipleDatabus) Offset(c context.Context)

Offset .

func (*AppMultipleDatabus) SetRecover

func (amd *AppMultipleDatabus) SetRecover(c context.Context, recoverID int64, recoverTime string, i int)

SetRecover set recover

func (*AppMultipleDatabus) Size

func (amd *AppMultipleDatabus) Size(c context.Context) (size int)

Size .

func (*AppMultipleDatabus) Sleep

func (amd *AppMultipleDatabus) Sleep(c context.Context)

Sleep .

type AppSingle

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

AppSingle .

func NewAppSingle

func NewAppSingle(d *Dao, appid string) (as *AppSingle)

NewAppSingle .

func (*AppSingle) AllMessages

func (as *AppSingle) AllMessages(c context.Context) (length int, err error)

AllMessages .

func (*AppSingle) BulkIndex

func (as *AppSingle) BulkIndex(c context.Context, start int, end int, writeEntityIndex bool) (err error)

BulkIndex .

func (*AppSingle) Business

func (as *AppSingle) Business() string

Business return business.

func (*AppSingle) Commit

func (as *AppSingle) Commit(c context.Context) (err error)

Commit commit offset.

func (*AppSingle) IncrMessages

func (as *AppSingle) IncrMessages(c context.Context) (length int, err error)

IncrMessages .

func (*AppSingle) InitIndex

func (as *AppSingle) InitIndex(c context.Context)

InitIndex init index.

func (*AppSingle) InitOffset

func (as *AppSingle) InitOffset(c context.Context)

InitOffset insert init value to offset.

func (*AppSingle) Offset

func (as *AppSingle) Offset(c context.Context)

Offset get offset.

func (*AppSingle) SetRecover

func (as *AppSingle) SetRecover(c context.Context, recoverID int64, recoverTime string, i int)

SetRecover set recover

func (*AppSingle) Size

func (as *AppSingle) Size(c context.Context) int

Size return size.

func (*AppSingle) Sleep

func (as *AppSingle) Sleep(c context.Context)

Sleep interval duration.

type Dao

type Dao struct {

	// search db
	SearchDB *xsql.DB
	// hbase        *hbase.Client
	BusinessPool map[string]model.BsnAppInfo
	AttrPool     map[string]*model.Attrs
	AppPool      map[string]App
	DBPool       map[string]*xsql.DB
	ESPool       map[string]*elastic.Client
	DatabusPool  map[string]*databus.Databus
	InfoCPool    map[string]*infoc.Infoc
	// contains filtered or unexported fields
}

Dao .

func New

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

New .

func (*Dao) BulkDBData

func (d *Dao) BulkDBData(c context.Context, attrs *model.Attrs, writeEntityIndex bool, bulkData ...model.MapData) (err error)

BulkDBData 写入es数据来自db.

func (*Dao) BulkDatabusData

func (d *Dao) BulkDatabusData(c context.Context, attrs *model.Attrs, writeEntityIndex bool, bulkData ...model.MapData) (err error)

BulkDatabusData 写入es数据来自databus.

func (*Dao) Close

func (d *Dao) Close()

Close close dao

func (*Dao) CommitOffset

func (d *Dao) CommitOffset(c context.Context, offset *model.LoopOffset, appid, tableName string) (err error)

CommitOffset .

func (*Dao) Contain

func (d *Dao) Contain(obj interface{}, target interface{}) bool

Contain .

func (*Dao) ExtraData

func (d *Dao) ExtraData(c context.Context, mapData []model.MapData, attrs *model.Attrs, way string, tags []string) (md []model.MapData, err error)

ExtraData .

func (*Dao) GetAliases

func (d *Dao) GetAliases(esName, indexAliasPrefix string) (aliases map[string]bool, err error)

GetAliases get all aliases by indexAliasPrefix

func (*Dao) GetConfig

func (d *Dao) GetConfig(c context.Context) *conf.Config

GetConfig .

func (*Dao) InitIndex

func (d *Dao) InitIndex(c context.Context, aliases map[string]bool, esName, indexAliasName, indexEntityName, indexMapping string)

InitIndex create entity indecies & aliases if necessary

func (*Dao) InitOffset

func (d *Dao) InitOffset(c context.Context, offset *model.LoopOffset, attrs *model.Attrs, arr []string)

InitOffset init offset to offset table .

func (*Dao) JSON2map

func (d *Dao) JSON2map(rowJSON json.RawMessage) (result map[string]interface{}, err error)

JSON2map json to map.

func (*Dao) Offset

func (d *Dao) Offset(c context.Context, appid, tableName string) (res *model.Offset, err error)

Offset get offset

func (*Dao) Ping

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

Ping health of db.

func (*Dao) PromError

func (d *Dao) PromError(name string, format string, args ...interface{})

PromError .

func (*Dao) SendSMS

func (d *Dao) SendSMS(msg string) (err error)

SendSMS .

func (*Dao) SetRecover

func (d *Dao) SetRecover(c context.Context, appid string, recoverID int64, recoverTime string, i int)

SetRecover set recover.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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