models

package
v0.6.0-beta.20210716.1755 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: BSD-3-Clause Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelRelations = []modelRelation{
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
}

Functions

func GetExecutables

func GetExecutables() (executables []entity.Executable, err error)

func GetLocalSystemInfo

func GetLocalSystemInfo() (sysInfo entity.SystemInfo, err error)

func GetModelColName

func GetModelColName(id interfaces.ModelId) (colName string)

func GetPathValues

func GetPathValues() (paths []string)

func GetSystemEnv

func GetSystemEnv(key string) string

Types

type Artifact

type Artifact struct {
	Id     primitive.ObjectID   `bson:"_id" json:"_id"`
	Col    string               `bson:"_col" json:"_col"`
	Del    bool                 `bson:"_del" json:"_del"`
	TagIds []primitive.ObjectID `bson:"_tid" json:"_tid"`
	Sys    *ArtifactSys         `bson:"_sys" json:"_sys"`
	Obj    interface{}          `bson:"_obj" json:"_obj"`
}

func (*Artifact) GetId

func (a *Artifact) GetId() (id primitive.ObjectID)

func (*Artifact) GetSys

func (a *Artifact) GetSys() (sys interfaces.ModelArtifactSys)

func (*Artifact) GetTagIds

func (a *Artifact) GetTagIds() (ids []primitive.ObjectID)

func (*Artifact) SetDel

func (a *Artifact) SetDel(del bool)

func (*Artifact) SetId

func (a *Artifact) SetId(id primitive.ObjectID)

func (*Artifact) SetObj

func (a *Artifact) SetObj(obj interfaces.Model)

func (*Artifact) SetTagIds

func (a *Artifact) SetTagIds(ids []primitive.ObjectID)

type ArtifactSys

type ArtifactSys struct {
	CreateTs  time.Time          `json:"create_ts" bson:"create_ts"`
	CreateUid primitive.ObjectID `json:"create_uid" bson:"create_uid"`
	UpdateTs  time.Time          `json:"update_ts" bson:"update_ts"`
	UpdateUid primitive.ObjectID `json:"update_uid" bson:"update_uid"`
	DeleteTs  time.Time          `json:"delete_ts" bson:"delete_ts"`
	DeleteUid primitive.ObjectID `json:"delete_uid" bson:"delete_uid"`
}

func (*ArtifactSys) GetCreateTs

func (sys *ArtifactSys) GetCreateTs() time.Time

func (*ArtifactSys) GetCreateUid

func (sys *ArtifactSys) GetCreateUid() primitive.ObjectID

func (*ArtifactSys) GetDeleteTs

func (sys *ArtifactSys) GetDeleteTs() time.Time

func (*ArtifactSys) GetDeleteUid

func (sys *ArtifactSys) GetDeleteUid() primitive.ObjectID

func (*ArtifactSys) GetUpdateTs

func (sys *ArtifactSys) GetUpdateTs() time.Time

func (*ArtifactSys) GetUpdateUid

func (sys *ArtifactSys) GetUpdateUid() primitive.ObjectID

func (*ArtifactSys) SetCreateTs

func (sys *ArtifactSys) SetCreateTs(ts time.Time)

func (*ArtifactSys) SetCreateUid

func (sys *ArtifactSys) SetCreateUid(id primitive.ObjectID)

func (*ArtifactSys) SetDeleteTs

func (sys *ArtifactSys) SetDeleteTs(ts time.Time)

func (*ArtifactSys) SetDeleteUid

func (sys *ArtifactSys) SetDeleteUid(id primitive.ObjectID)

func (*ArtifactSys) SetUpdateTs

func (sys *ArtifactSys) SetUpdateTs(ts time.Time)

func (*ArtifactSys) SetUpdateUid

func (sys *ArtifactSys) SetUpdateUid(id primitive.ObjectID)

type BaseModel

type BaseModel struct {
	Id   primitive.ObjectID `json:"_id" bson:"_id"`
	Tags []Tag              `json:"tags" bson:"-"`
}

func (*BaseModel) GetId

func (d *BaseModel) GetId() (id primitive.ObjectID)

type DataCollection

type DataCollection struct {
	Id   primitive.ObjectID `json:"_id" bson:"_id"`
	Name string             `json:"name" bson:"name"`
}

func (*DataCollection) GetId

func (dc *DataCollection) GetId() (id primitive.ObjectID)

func (*DataCollection) SetId

func (dc *DataCollection) SetId(id primitive.ObjectID)

type DataField

type DataField struct {
	Id   primitive.ObjectID `json:"_id" bson:"_id"`
	Key  string             `json:"key" bson:"key"`
	Name string             `json:"name" bson:"name"`
}

type DataSource

type DataSource struct {
	Id   primitive.ObjectID `json:"_id" bson:"_id"`
	Name string             `json:"name" bson:"name"`
}

func (*DataSource) GetId

func (ds *DataSource) GetId() (id primitive.ObjectID)

func (*DataSource) SetId

func (ds *DataSource) SetId(id primitive.ObjectID)

type Env

type Env struct {
	Name  string `json:"name" bson:"name"`
	Value string `json:"value" bson:"value"`
}

type Job

type Job struct {
	Id     primitive.ObjectID `bson:"_id" json:"_id"`
	TaskId primitive.ObjectID `bson:"task_id" json:"task_id"`
}

func (*Job) GetId

func (j *Job) GetId() (id primitive.ObjectID)

func (*Job) SetId

func (j *Job) SetId(id primitive.ObjectID)

type ModelListMap

type ModelListMap struct {
	Artifacts       []Artifact
	Tags            []Tag
	Nodes           []Node
	Projects        []Project
	Spiders         []Spider
	Tasks           []Task
	Jobs            []Job
	Schedules       []Schedule
	Users           []User
	Settings        []Setting
	Tokens          []Token
	Variables       []Variable
	TaskQueueItems  []TaskQueueItem
	TaskStats       []TaskStat
	Plugins         []Plugin
	SpiderStats     []SpiderStat
	DataSources     []DataSource
	DataCollections []DataCollection
	Results         []Result
	Passwords       []Password
}

func NewModelListMap

func NewModelListMap() (m *ModelListMap)

type ModelMap

type ModelMap struct {
	Artifact       Artifact
	Tag            Tag
	Node           Node
	Project        Project
	Spider         Spider
	Task           Task
	Job            Job
	Schedule       Schedule
	User           User
	Setting        Setting
	Token          Token
	Variable       Variable
	TaskQueueItem  TaskQueueItem
	TaskStat       TaskStat
	Plugin         Plugin
	SpiderStat     SpiderStat
	DataSource     DataSource
	DataCollection DataCollection
	Result         Result
	Password       Password
}

func NewModelMap

func NewModelMap() (m *ModelMap)

type Node

type Node struct {
	Id               primitive.ObjectID `json:"_id" bson:"_id"`
	Key              string             `json:"key" bson:"k"`
	Name             string             `json:"name" bson:"n"`
	Ip               string             `json:"ip" bson:"ip"`
	Port             string             `json:"port" bson:"p"`
	Mac              string             `json:"mac" bson:"m"`
	Hostname         string             `json:"hostname" bson:"h"`
	Description      string             `json:"description" bson:"d"`
	IsMaster         bool               `json:"is_master" bson:"im"`
	Status           string             `json:"status" bson:"s"`
	Enabled          bool               `json:"enabled" bson:"en"`
	Active           bool               `json:"active" bson:"a"`
	ActiveTs         time.Time          `json:"active_ts" bson:"at"`
	AvailableRunners int                `json:"available_runners" bson:"ar"`
	MaxRunners       int                `json:"max_runners" bson:"mr"`
	Tags             []Tag              `json:"tags" bson:"-"`
}

func (*Node) DecrementAvailableRunners

func (n *Node) DecrementAvailableRunners()

func (*Node) GetAvailableRunners

func (n *Node) GetAvailableRunners() (runners int)

func (*Node) GetEnabled

func (n *Node) GetEnabled() (enabled bool)

func (*Node) GetId

func (n *Node) GetId() (id primitive.ObjectID)

func (*Node) GetIsMaster

func (n *Node) GetIsMaster() (ok bool)

func (*Node) GetKey

func (n *Node) GetKey() (key string)

func (*Node) GetMaxRunners

func (n *Node) GetMaxRunners() (runners int)

func (*Node) GetStatus

func (n *Node) GetStatus() (status string)

func (*Node) GetTags

func (n *Node) GetTags() (tags []interfaces.Tag)

func (*Node) IncrementAvailableRunners

func (n *Node) IncrementAvailableRunners()

func (*Node) SetActive

func (n *Node) SetActive(active bool)

func (*Node) SetActiveTs

func (n *Node) SetActiveTs(activeTs time.Time)

func (*Node) SetAvailableRunners

func (n *Node) SetAvailableRunners(runners int)

func (*Node) SetEnabled

func (n *Node) SetEnabled(enabled bool)

func (*Node) SetId

func (n *Node) SetId(id primitive.ObjectID)

func (*Node) SetMaxRunners

func (n *Node) SetMaxRunners(runners int)

func (*Node) SetStatus

func (n *Node) SetStatus(status string)

func (*Node) SetTags

func (n *Node) SetTags(tags []interfaces.Tag)

type Password

type Password struct {
	Id       primitive.ObjectID `json:"_id" bson:"_id"`
	Password string             `json:"password" bson:"p"`
}

func (*Password) GetId

func (p *Password) GetId() (id primitive.ObjectID)

func (*Password) SetId

func (p *Password) SetId(id primitive.ObjectID)

type Plugin

type Plugin struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description"`
	Cmd         string             `json:"cmd" bson:"cmd"`
}

func (*Plugin) GetId

func (p *Plugin) GetId() (id primitive.ObjectID)

func (*Plugin) SetId

func (p *Plugin) SetId(id primitive.ObjectID)

type Project

type Project struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description"`
	Tags        []Tag              `json:"tags" bson:"-"`
	Spiders     int                `json:"spiders" bson:"-"`
}

func (*Project) GetId

func (p *Project) GetId() (id primitive.ObjectID)

func (*Project) GetTags

func (p *Project) GetTags() (tags []interfaces.Tag)

func (*Project) SetId

func (p *Project) SetId(id primitive.ObjectID)

func (*Project) SetTags

func (p *Project) SetTags(tags []interfaces.Tag)

type Result

type Result bson.M

func (*Result) GetId

func (r *Result) GetId() (id primitive.ObjectID)

func (*Result) GetTaskId

func (r *Result) GetTaskId() (id primitive.ObjectID)

func (*Result) GetValue

func (r *Result) GetValue(key string) (value interface{})

func (*Result) SetId

func (r *Result) SetId(id primitive.ObjectID)

func (*Result) SetTaskId

func (r *Result) SetTaskId(id primitive.ObjectID)

func (*Result) SetValue

func (r *Result) SetValue(key string, value interface{})

func (*Result) Value

func (r *Result) Value() map[string]interface{}

type Schedule

type Schedule struct {
	Id             primitive.ObjectID   `json:"_id" bson:"_id"`
	Name           string               `json:"name" bson:"name"`
	Description    string               `json:"description" bson:"description"`
	SpiderId       primitive.ObjectID   `json:"spider_id" bson:"spider_id"`
	Cron           string               `json:"cron" bson:"cron"`
	EntryId        cron.EntryID         `json:"entry_id" bson:"entry_id"`
	Cmd            string               `json:"cmd" bson:"cmd"`
	Param          string               `json:"param" bson:"param"`
	Mode           string               `json:"mode" bson:"mode"`
	NodeIds        []primitive.ObjectID `json:"node_ids" bson:"node_ids"`
	NodeTags       []string             `json:"node_tags" bson:"node_tags"`
	Priority       int                  `json:"priority" bson:"priority"`
	Enabled        bool                 `json:"enabled" bson:"enabled"`
	UserId         primitive.ObjectID   `json:"user_id" bson:"user_id"`
	ScrapySpider   string               `json:"scrapy_spider" bson:"scrapy_spider"`
	ScrapyLogLevel string               `json:"scrapy_log_level" bson:"scrapy_log_level"`
	Tags           []string             `json:"tags" bson:"-"`
}

func (*Schedule) GetCmd

func (s *Schedule) GetCmd() (cmd string)

func (*Schedule) GetCron

func (s *Schedule) GetCron() (c string)

func (*Schedule) GetEnabled

func (s *Schedule) GetEnabled() (enabled bool)

func (*Schedule) GetEntryId

func (s *Schedule) GetEntryId() (id cron.EntryID)

func (*Schedule) GetId

func (s *Schedule) GetId() (id primitive.ObjectID)

func (*Schedule) GetMode

func (s *Schedule) GetMode() (mode string)

func (*Schedule) GetNodeIds

func (s *Schedule) GetNodeIds() (ids []primitive.ObjectID)

func (*Schedule) GetNodeTags

func (s *Schedule) GetNodeTags() (tags []string)

func (*Schedule) GetParam

func (s *Schedule) GetParam() (param string)

func (*Schedule) GetPriority

func (s *Schedule) GetPriority() (p int)

func (*Schedule) GetSpiderId

func (s *Schedule) GetSpiderId() (id primitive.ObjectID)

func (*Schedule) SetCmd

func (s *Schedule) SetCmd(cmd string)

func (*Schedule) SetCron

func (s *Schedule) SetCron(c string)

func (*Schedule) SetEnabled

func (s *Schedule) SetEnabled(enabled bool)

func (*Schedule) SetEntryId

func (s *Schedule) SetEntryId(id cron.EntryID)

func (*Schedule) SetId

func (s *Schedule) SetId(id primitive.ObjectID)

func (*Schedule) SetMode

func (s *Schedule) SetMode(mode string)

func (*Schedule) SetNodeIds

func (s *Schedule) SetNodeIds(ids []primitive.ObjectID)

func (*Schedule) SetNodeTags

func (s *Schedule) SetNodeTags(tags []string)

func (*Schedule) SetParam

func (s *Schedule) SetParam(param string)

func (*Schedule) SetPriority

func (s *Schedule) SetPriority(p int)

func (*Schedule) SetSpiderId

func (s *Schedule) SetSpiderId(id primitive.ObjectID)

type Setting

type Setting struct {
	Id    primitive.ObjectID `json:"_id" bson:"_id"`
	Key   string             `json:"key" bson:"key"`
	Value string             `json:"value" bson:"value"`
}

func (*Setting) GetId

func (s *Setting) GetId() (id primitive.ObjectID)

func (*Setting) SetId

func (s *Setting) SetId(id primitive.ObjectID)

type Spider

type Spider struct {
	Id          primitive.ObjectID   `json:"_id" bson:"_id"`                 // spider id
	Name        string               `json:"name" bson:"name"`               // spider name
	Type        string               `json:"type" bson:"type"`               // spider type
	ColId       primitive.ObjectID   `json:"col_id" bson:"col_id"`           // data collection id
	ColName     string               `json:"col_name,omitempty" bson:"-"`    // data collection name
	Description string               `json:"description" bson:"description"` // description
	ProjectId   primitive.ObjectID   `json:"project_id" bson:"project_id"`   // Project.Id
	Mode        string               `json:"mode" bson:"mode"`               // default Task.Mode
	NodeIds     []primitive.ObjectID `json:"node_ids" bson:"node_ids"`       // default Task.NodeIds
	NodeTags    []string             `json:"node_tags" bson:"node_tags"`     // default Task.NodeTags
	Tags        []Tag                `json:"tags" bson:"-"`                  // tags
	Stat        *SpiderStat          `json:"stat,omitempty" bson:"-"`

	IsPublic bool  `json:"is_public" bson:"is_public"` // 是否公开
	Envs     []Env `json:"envs" bson:"envs"`           // 环境变量

	// 自定义爬虫
	Cmd      string `json:"cmd" bson:"cmd"`     // 执行命令
	Param    string `json:"param" bson:"param"` // default task param
	Priority int    `json:"priority" bson:"priority"`

	// Scrapy 爬虫(属于自定义爬虫)
	IsScrapy    bool     `json:"is_scrapy" bson:"is_scrapy"`       // 是否为 Scrapy 爬虫
	SpiderNames []string `json:"spider_names" bson:"spider_names"` // 爬虫名称列表

	// 可配置爬虫
	Template string `json:"template" bson:"template"` // Spiderfile模版

	// Git 设置
	IsGit            bool   `json:"is_git" bson:"is_git"`                         // 是否为 Git
	GitUrl           string `json:"git_url" bson:"git_url"`                       // Git URL
	GitBranch        string `json:"git_branch" bson:"git_branch"`                 // Git 分支
	GitHasCredential bool   `json:"git_has_credential" bson:"git_has_credential"` // Git 是否加密
	GitUsername      string `json:"git_username" bson:"git_username"`             // Git 用户名
	GitPassword      string `json:"git_password" bson:"git_password"`             // Git 密码
	GitAutoSync      bool   `json:"git_auto_sync" bson:"git_auto_sync"`           // Git 是否自动同步
	GitSyncFrequency string `json:"git_sync_frequency" bson:"git_sync_frequency"` // Git 同步频率
	GitSyncError     string `json:"git_sync_error" bson:"git_sync_error"`         // Git 同步错误

	// 长任务
	IsLongTask bool `json:"is_long_task" bson:"is_long_task"` // 是否为长任务

	// 去重
	IsDedup     bool   `json:"is_dedup" bson:"is_dedup"`         // 是否去重
	DedupField  string `json:"dedup_field" bson:"dedup_field"`   // 去重字段
	DedupMethod string `json:"dedup_method" bson:"dedup_method"` // 去重方式

	// Web Hook
	IsWebHook  bool   `json:"is_web_hook" bson:"is_web_hook"`   // 是否开启 Web Hook
	WebHookUrl string `json:"web_hook_url" bson:"web_hook_url"` // Web Hook URL
}

func (*Spider) GetCmd

func (s *Spider) GetCmd() (cmd string)

func (*Spider) GetId

func (s *Spider) GetId() (id primitive.ObjectID)

func (*Spider) GetMode

func (s *Spider) GetMode() (mode string)

func (*Spider) GetNodeIds

func (s *Spider) GetNodeIds() (ids []primitive.ObjectID)

func (*Spider) GetNodeTags

func (s *Spider) GetNodeTags() (tags []string)

func (*Spider) GetParam

func (s *Spider) GetParam() (param string)

func (*Spider) GetPriority

func (s *Spider) GetPriority() (p int)

func (*Spider) GetTags

func (s *Spider) GetTags() (tags []interfaces.Tag)

func (*Spider) GetType

func (s *Spider) GetType() (ty string)

func (*Spider) SetCmd

func (s *Spider) SetCmd(cmd string)

func (*Spider) SetId

func (s *Spider) SetId(id primitive.ObjectID)

func (*Spider) SetMode

func (s *Spider) SetMode(mode string)

func (*Spider) SetNodeIds

func (s *Spider) SetNodeIds(ids []primitive.ObjectID)

func (*Spider) SetNodeTags

func (s *Spider) SetNodeTags(tags []string)

func (*Spider) SetParam

func (s *Spider) SetParam(param string)

func (*Spider) SetPriority

func (s *Spider) SetPriority(p int)

func (*Spider) SetTags

func (s *Spider) SetTags(tags []interfaces.Tag)

type SpiderStat

type SpiderStat struct {
	Id                     primitive.ObjectID `json:"_id" bson:"_id"`
	LastTaskId             primitive.ObjectID `json:"last_task_id" bson:"ltid"`
	LastTask               *Task              `json:"last_task,omitempty" bson:"-"`
	Tasks                  int                `json:"tasks" bson:"t"`
	Results                int                `json:"results" bson:"r"`
	WaitDuration           int64              `json:"wait_duration" bson:"wd"`           // in second
	RuntimeDuration        int64              `json:"runtime_duration" bson:"rd"`        // in second
	TotalDuration          int64              `json:"total_duration" bson:"td"`          // in second
	AverageWaitDuration    int64              `json:"average_wait_duration" bson:"-"`    // in second
	AverageRuntimeDuration int64              `json:"average_runtime_duration" bson:"-"` // in second
	AverageTotalDuration   int64              `json:"average_total_duration" bson:"-"`   // in second
}

func (*SpiderStat) GetId

func (s *SpiderStat) GetId() (id primitive.ObjectID)

func (*SpiderStat) SetId

func (s *SpiderStat) SetId(id primitive.ObjectID)

type Tag

type Tag struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Name        string             `json:"name" bson:"name"`
	Color       string             `json:"color" bson:"color"`
	Description string             `json:"description" bson:"description"`
	Col         string             `json:"col" bson:"col"`
}

func (*Tag) GetColor

func (t *Tag) GetColor() (res string)

func (*Tag) GetId

func (t *Tag) GetId() (id primitive.ObjectID)

func (*Tag) GetName

func (t *Tag) GetName() (res string)

func (*Tag) SetCol

func (t *Tag) SetCol(col string)

func (*Tag) SetId

func (t *Tag) SetId(id primitive.ObjectID)

type Task

type Task struct {
	Id         primitive.ObjectID   `json:"_id" bson:"_id"`
	SpiderId   primitive.ObjectID   `json:"spider_id" bson:"spider_id"`
	Status     string               `json:"status" bson:"status"`
	NodeId     primitive.ObjectID   `json:"node_id" bson:"node_id"`
	Cmd        string               `json:"cmd" bson:"cmd"`
	Param      string               `json:"param" bson:"param"`
	Error      string               `json:"error" bson:"error"`
	Pid        int                  `json:"pid" bson:"pid"`
	ScheduleId primitive.ObjectID   `json:"schedule_id" bson:"schedule_id"` // Schedule.Id
	Type       string               `json:"type" bson:"type"`
	Mode       string               `json:"mode" bson:"mode"`           // running mode of Task
	NodeIds    []primitive.ObjectID `json:"node_ids" bson:"node_ids"`   // list of Node.Id
	NodeTags   []string             `json:"node_tags" bson:"node_tags"` // list of Node.Tag
	ParentId   primitive.ObjectID   `json:"parent_id" bson:"parent_id"` // parent Task.Id if it'Spider a sub-task
	Priority   int                  `json:"priority" bson:"priority"`
	Stat       *TaskStat            `json:"stat,omitempty" bson:"-"`
}

func (*Task) GetCmd

func (t *Task) GetCmd() (cmd string)

func (*Task) GetError

func (t *Task) GetError() (error string)

func (*Task) GetId

func (t *Task) GetId() (id primitive.ObjectID)

func (*Task) GetNodeId

func (t *Task) GetNodeId() (id primitive.ObjectID)

func (*Task) GetNodeIds

func (t *Task) GetNodeIds() (ids []primitive.ObjectID)

func (*Task) GetNodeTags

func (t *Task) GetNodeTags() (nodeTags []string)

func (*Task) GetParam

func (t *Task) GetParam() (param string)

func (*Task) GetPriority

func (t *Task) GetPriority() (p int)

func (*Task) GetSpiderId

func (t *Task) GetSpiderId() (id primitive.ObjectID)

func (*Task) GetStatus

func (t *Task) GetStatus() (status string)

func (*Task) GetType

func (t *Task) GetType() (ty string)

func (*Task) SetError

func (t *Task) SetError(error string)

func (*Task) SetId

func (t *Task) SetId(id primitive.ObjectID)

func (*Task) SetNodeId

func (t *Task) SetNodeId(id primitive.ObjectID)

func (*Task) SetStatus

func (t *Task) SetStatus(status string)

type TaskDailyItem

type TaskDailyItem struct {
	Date               string  `json:"date" bson:"_id"`
	TaskCount          int     `json:"task_count" bson:"task_count"`
	AvgRuntimeDuration float64 `json:"avg_runtime_duration" bson:"avg_runtime_duration"`
}

type TaskQueueItem

type TaskQueueItem struct {
	Id       primitive.ObjectID `json:"_id" bson:"_id"`
	Priority int                `json:"p" bson:"p"`
}

func (*TaskQueueItem) GetId

func (t *TaskQueueItem) GetId() (id primitive.ObjectID)

func (*TaskQueueItem) SetId

func (t *TaskQueueItem) SetId(id primitive.ObjectID)

type TaskStat

type TaskStat struct {
	Id              primitive.ObjectID `json:"_id" bson:"_id"`
	CreateTs        time.Time          `json:"create_ts" bson:"cts"`
	StartTs         time.Time          `json:"start_ts" bson:"sts"`
	EndTs           time.Time          `json:"end_ts" bson:"ets"`
	WaitDuration    int64              `json:"wait_duration" bson:"wd"`    // in millisecond
	RuntimeDuration int64              `json:"runtime_duration" bson:"rd"` // in millisecond
	TotalDuration   int64              `json:"total_duration" bson:"td"`   // in millisecond
	ResultCount     int64              `json:"result_count" bson:"rc"`
	ErrorLogCount   int64              `json:"error_log_count" bson:"elc"`
}

func (*TaskStat) GetCreateTs

func (s *TaskStat) GetCreateTs() (ts time.Time)

func (*TaskStat) GetEndTs

func (s *TaskStat) GetEndTs() (ts time.Time)

func (*TaskStat) GetErrorLogCount

func (s *TaskStat) GetErrorLogCount() (c int64)

func (*TaskStat) GetId

func (s *TaskStat) GetId() (id primitive.ObjectID)

func (*TaskStat) GetResultCount

func (s *TaskStat) GetResultCount() (c int64)

func (*TaskStat) GetRuntimeDuration

func (s *TaskStat) GetRuntimeDuration() (d int64)

func (*TaskStat) GetStartTs

func (s *TaskStat) GetStartTs() (ts time.Time)

func (*TaskStat) GetTotalDuration

func (s *TaskStat) GetTotalDuration() (d int64)

func (*TaskStat) GetWaitDuration

func (s *TaskStat) GetWaitDuration() (d int64)

func (*TaskStat) SetCreateTs

func (s *TaskStat) SetCreateTs(ts time.Time)

func (*TaskStat) SetEndTs

func (s *TaskStat) SetEndTs(ts time.Time)

func (*TaskStat) SetErrorLogCount

func (s *TaskStat) SetErrorLogCount(c int64)

func (*TaskStat) SetId

func (s *TaskStat) SetId(id primitive.ObjectID)

func (*TaskStat) SetResultCount

func (s *TaskStat) SetResultCount(c int64)

func (*TaskStat) SetRuntimeDuration

func (s *TaskStat) SetRuntimeDuration(d int64)

func (*TaskStat) SetStartTs

func (s *TaskStat) SetStartTs(ts time.Time)

func (*TaskStat) SetTotalDuration

func (s *TaskStat) SetTotalDuration(d int64)

func (*TaskStat) SetWaitDuration

func (s *TaskStat) SetWaitDuration(d int64)

type Token

type Token struct {
	Id    primitive.ObjectID `json:"_id" bson:"_id"`
	Name  string             `json:"name" bson:"name"`
	Token string             `json:"token" bson:"token"`
}

func (*Token) GetId

func (t *Token) GetId() (id primitive.ObjectID)

func (*Token) SetId

func (t *Token) SetId(id primitive.ObjectID)

type User

type User struct {
	Id       primitive.ObjectID `json:"_id" bson:"_id"`
	Username string             `json:"username" bson:"username"`
	Password string             `json:"password,omitempty" bson:"-"`
	Role     string             `json:"role" bson:"role"`
	Email    string             `json:"email" bson:"email"`
	Setting  UserSetting        `json:"setting" bson:"setting"`
}

func (*User) GetEmail

func (u *User) GetEmail() (email string)

func (*User) GetId

func (u *User) GetId() (id primitive.ObjectID)

func (*User) GetPassword

func (u *User) GetPassword() (p string)

func (*User) GetRole

func (u *User) GetRole() (r string)

func (*User) GetUsername

func (u *User) GetUsername() (name string)

func (*User) SetId

func (u *User) SetId(id primitive.ObjectID)

type UserSetting

type UserSetting struct {
	NotificationTrigger  string   `json:"notification_trigger" bson:"notification_trigger"`
	DingTalkRobotWebhook string   `json:"ding_talk_robot_webhook" bson:"ding_talk_robot_webhook"`
	WechatRobotWebhook   string   `json:"wechat_robot_webhook" bson:"wechat_robot_webhook"`
	EnabledNotifications []string `json:"enabled_notifications" bson:"enabled_notifications"`
	ErrorRegexPattern    string   `json:"error_regex_pattern" bson:"error_regex_pattern"`
	MaxErrorLog          int      `json:"max_error_log" bson:"max_error_log"`
	LogExpireDuration    int64    `json:"log_expire_duration" bson:"log_expire_duration"`
}

type Variable

type Variable struct {
	Id     primitive.ObjectID `json:"_id" bson:"_id"`
	Key    string             `json:"key" bson:"key"`
	Value  string             `json:"value" bson:"value"`
	Remark string             `json:"remark" bson:"remark"`
}

func (*Variable) GetId

func (v *Variable) GetId() (id primitive.ObjectID)

func (*Variable) SetId

func (v *Variable) SetId(id primitive.ObjectID)

Jump to

Keyboard shortcuts

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