model

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

Documentation

Index

Constants

View Source
const (
	// PushTypeUnknown 用户未上报推送设置
	PushTypeUnknown = iota
	// PushTypeForbid 禁止推送稿件更新通知
	PushTypeForbid
	// PushTypeSpecial  推送特别关注的upper的更新
	PushTypeSpecial
	// PushTypeAttention 推送关注的upper的更新
	PushTypeAttention
)
View Source
const (
	// RelationAttention 关注
	RelationAttention = iota + 1
	// RelationSpecial 特别关注
	RelationSpecial
)
View Source
const (
	// StatisticsUnpush 命中分组但未推送
	StatisticsUnpush = iota
	// StatisticsPush 命中分组且推送
	StatisticsPush = 1
)
View Source
const (
	// GroupDataTypeDefault 默认
	GroupDataTypeDefault = "default"
	// GroupDataTypeHBase AI脚本提供的hbase数据
	GroupDataTypeHBase = "hbase"
	// GroupDataTypeAbtest ab实验数据
	GroupDataTypeAbtest = "ab_test"
	// GroupDataTypeAbComparison ab对照数据
	GroupDataTypeAbComparison = "ab_comparison"
)
View Source
const (
	// AttrBitIsPGC pgc稿件的属性位
	AttrBitIsPGC = 9
)

Variables

View Source
var (
	// BaseParamHandler fn
	BaseParamHandler = func(target *map[string]interface{}, args ...interface{}) {}
	// PushParamHandler fn
	PushParamHandler = func(target *map[string]interface{}, args ...interface{}) {
		var (
			ok   bool
			arc  *Archive
			fans []int64
		)
		if target == nil || (*target)["archive"] == nil {
			log.Warn("PushParamHandler target(%+v)/target[archive] nil, args(%+v)", target, args)
		} else if arc, ok = (*target)["archive"].(*Archive); !ok || arc == nil {
			log.Warn("PushParamHandler target[archive]=%+v parse failed/nil, args(%+v), target(%+v)", (*target)["archive"], args, target)
		}
		if arc == nil {
			arc = &Archive{}
		}

		if len(args) != 1 || args[0] == nil {
			log.Warn("PushParamHandler args(%+v) less than 1 or nil, target(%+v) archive(%+v)", args, target, arc)
		} else if fans, ok = args[0].([]int64); !ok {
			log.Warn("PushParamHandler args(%+v) parse failed, target(%+v) archive(%+v)", args, target, arc)
		}

		b := md5.Sum([]byte(fmt.Sprintf("%d%s", arc.ID, xstr.JoinInts(fans))))
		(*target)["uuid"] = fmt.Sprintf("%s%d", hex.EncodeToString(b[:]), time.Now().UnixNano())
	}
)

Functions

This section is empty.

Types

type Archive

type Archive struct {
	ID        int64  `json:"aid"`
	Mid       int64  `json:"mid"`
	TypeID    int16  `json:"typeid"`
	HumanRank int    `json:"humanrank"`
	Duration  int    `json:"duration"`
	Title     string `json:"title"`
	Cover     string `json:"cover"`
	Content   string `json:"content"`
	Tag       string `json:"tag"`
	Attribute int32  `json:"attribute"`
	Copyright int8   `json:"copyright"`
	AreaLimit int8   `json:"arealimit"`
	State     int    `json:"state"`
	Author    string `json:"author"`
	Access    int    `json:"access"`
	Forward   int    `json:"forward"`
	PubTime   string `json:"pubtime"`
	Round     int8   `json:"round"`
	CTime     string `json:"ctime"`
	MTime     string `json:"mtime"`
}

Archive model

func (*Archive) IsNormal

func (a *Archive) IsNormal() bool

IsNormal judge that whether archive's state is normally.

type BatchParam

type BatchParam struct {
	Params  map[string]interface{}
	Handler ParamHandler
}

BatchParam str

func NewBatchParam

func NewBatchParam(p map[string]interface{}, h ParamHandler) *BatchParam

NewBatchParam func

type Ints

type Ints []int64

Ints be used to MySql\Protobuf varbinary converting.

func (Ints) Bytes

func (is Ints) Bytes() []byte

Bytes marshal int64 slice to bytes,each int64 will occupy Fixed 8 bytes

func (*Ints) Evict

func (is *Ints) Evict(e int64) (ok bool)

Evict get rid of the sepcified num from the slice

func (Ints) Exist

func (is Ints) Exist(i int64) (e bool)

Exist judge the sepcified num is in the slice or not

func (Ints) MarshalTo

func (is Ints) MarshalTo(data []byte) (int, error)

MarshalTo marshal int64 slice to bytes,each int64 will occupy Fixed 8 bytes. if the argument data not supplied with the full size,it will return the actual written size

func (*Ints) Scan

func (is *Ints) Scan(src interface{}) (err error)

Scan parse the data into int64 slice

func (Ints) Size

func (is Ints) Size() int

Size return the total size it will occupy in bytes

func (*Ints) Unmarshal

func (is *Ints) Unmarshal(data []byte) error

Unmarshal parse the data into int64 slice

func (Ints) Value

func (is Ints) Value() (driver.Value, error)

Value marshal int64 slice to driver.Value,each int64 will occupy Fixed 8 bytes

type Message

type Message struct {
	Action string          `json:"action"`
	Table  string          `json:"table"`
	New    json.RawMessage `json:"new"`
	Old    json.RawMessage `json:"old"`
}

Message canal databus message.

type ParamHandler

type ParamHandler func(target *map[string]interface{}, args ...interface{})

ParamHandler fn

type PushStatistic

type PushStatistic struct {
	Aid         int64     `json:"aid"`
	Group       string    `json:"group"`
	Type        int       `json:"type"`
	Mids        string    `json:"mids"`
	MidsCounter int       `json:"mids_counter"`
	CTime       time.Time `json:"ctime"`
}

PushStatistic 推送统计数据对象

type Relation

type Relation struct {
	Mid       int64  `json:"mid,omitempty"`
	Fid       int64  `json:"fid,omitempty"`
	Attribute uint32 `json:"attribute"`
	Status    int    `json:"status"`
	MTime     string `json:"mtime"`
	CTime     string `json:"ctime"`
}

Relation user relation.

func (*Relation) Following

func (r *Relation) Following() bool

Following judge that whether has following relation.

type RelationTagUser

type RelationTagUser struct {
	Mid   int64  `json:"mid,omitempty"`
	Fid   int64  `json:"fid,omitempty"`
	Tag   string `json:"tag"`
	MTime string `json:"mtime"`
	CTime string `json:"ctime"`
}

RelationTagUser user relatino tag.

func (*RelationTagUser) HasTag

func (r *RelationTagUser) HasTag(tag int64) bool

HasTag judge that whether has specified tag.

type Setting

type Setting struct {
	Type int `json:"type"`
}

Setting user push setting.

Jump to

Keyboard shortcuts

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