models

package
v0.0.0-...-ff2830b Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModelColName

func GetModelColName(id interfaces.ModelId) (colName 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 ArtifactList

type ArtifactList []Artifact

func (*ArtifactList) GetModels

func (l *ArtifactList) GetModels() (res []interfaces.Model)

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"`
}

func (*BaseModel) GetId

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

type BaseModelV2

type BaseModelV2[T any] struct {
	Id        primitive.ObjectID `json:"_id" bson:"_id"`
	CreatedAt time.Time          `json:"created_ts" bson:"created_ts"`
	CreatedBy primitive.ObjectID `json:"created_by" bson:"created_by"`
	UpdatedAt time.Time          `json:"updated_ts" bson:"updated_ts"`
	UpdatedBy primitive.ObjectID `json:"updated_by" bson:"updated_by"`
}

func (*BaseModelV2[T]) GetCreatedAt

func (m *BaseModelV2[T]) GetCreatedAt() time.Time

func (*BaseModelV2[T]) GetCreatedBy

func (m *BaseModelV2[T]) GetCreatedBy() primitive.ObjectID

func (*BaseModelV2[T]) GetId

func (m *BaseModelV2[T]) GetId() primitive.ObjectID

func (*BaseModelV2[T]) GetUpdatedAt

func (m *BaseModelV2[T]) GetUpdatedAt() time.Time

func (*BaseModelV2[T]) GetUpdatedBy

func (m *BaseModelV2[T]) GetUpdatedBy() primitive.ObjectID

func (*BaseModelV2[T]) SetCreated

func (m *BaseModelV2[T]) SetCreated(id primitive.ObjectID)

func (*BaseModelV2[T]) SetCreatedAt

func (m *BaseModelV2[T]) SetCreatedAt(t time.Time)

func (*BaseModelV2[T]) SetCreatedBy

func (m *BaseModelV2[T]) SetCreatedBy(id primitive.ObjectID)

func (*BaseModelV2[T]) SetId

func (m *BaseModelV2[T]) SetId(id primitive.ObjectID)

func (*BaseModelV2[T]) SetUpdated

func (m *BaseModelV2[T]) SetUpdated(id primitive.ObjectID)

func (*BaseModelV2[T]) SetUpdatedAt

func (m *BaseModelV2[T]) SetUpdatedAt(t time.Time)

func (*BaseModelV2[T]) SetUpdatedBy

func (m *BaseModelV2[T]) SetUpdatedBy(id primitive.ObjectID)

type DataCollection

type DataCollection struct {
	Id     primitive.ObjectID `json:"_id" bson:"_id"`
	Name   string             `json:"name" bson:"name"`
	Fields []entity.DataField `json:"fields" bson:"fields"`
	Dedup  struct {
		Enabled bool     `json:"enabled" bson:"enabled"`
		Keys    []string `json:"keys" bson:"keys"`
		Type    string   `json:"type" bson:"type"`
	} `json:"dedup" bson:"dedup"`
}

func (*DataCollection) GetId

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

func (*DataCollection) SetId

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

type DataCollectionList

type DataCollectionList []DataCollection

func (*DataCollectionList) GetModels

func (l *DataCollectionList) GetModels() (res []interfaces.Model)

type DataCollectionV2

type DataCollectionV2 struct {
	BaseModelV2[DataCollection] `bson:",inline"`
	Name                        string             `json:"name" bson:"name"`
	Fields                      []entity.DataField `json:"fields" bson:"fields"`
	Dedup                       struct {
		Enabled bool     `json:"enabled" bson:"enabled"`
		Keys    []string `json:"keys" bson:"keys"`
		Type    string   `json:"type" bson:"type"`
	} `json:"dedup" bson:"dedup"`
	// contains filtered or unexported fields
}

type DataSource

type DataSource struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Name        string             `json:"name" bson:"name"`
	Type        string             `json:"type" bson:"type"`
	Description string             `json:"description" bson:"description"`
	Host        string             `json:"host" bson:"host"`
	Port        string             `json:"port" bson:"port"`
	Url         string             `json:"url" bson:"url"`
	Hosts       []string           `json:"hosts" bson:"hosts"`
	Database    string             `json:"database" bson:"database"`
	Username    string             `json:"username" bson:"username"`
	Password    string             `json:"password,omitempty" bson:"-"`
	ConnectType string             `json:"connect_type" bson:"connect_type"`
	Status      string             `json:"status" bson:"status"`
	Error       string             `json:"error" bson:"error"`
	Extra       map[string]string  `json:"extra,omitempty" bson:"extra,omitempty"`
}

func (*DataSource) GetId

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

func (*DataSource) SetId

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

type DataSourceList

type DataSourceList []DataSource

func (*DataSourceList) GetModels

func (l *DataSourceList) GetModels() (res []interfaces.Model)

type DataSourceV2

type DataSourceV2 struct {
	BaseModelV2[DataSource] `bson:",inline"`
	Name                    string            `json:"name" bson:"name"`
	Type                    string            `json:"type" bson:"type"`
	Description             string            `json:"description" bson:"description"`
	Host                    string            `json:"host" bson:"host"`
	Port                    string            `json:"port" bson:"port"`
	Url                     string            `json:"url" bson:"url"`
	Hosts                   []string          `json:"hosts" bson:"hosts"`
	Database                string            `json:"database" bson:"database"`
	Username                string            `json:"username" bson:"username"`
	Password                string            `json:"password,omitempty" bson:"-"`
	ConnectType             string            `json:"connect_type" bson:"connect_type"`
	Status                  string            `json:"status" bson:"status"`
	Error                   string            `json:"error" bson:"error"`
	Extra                   map[string]string `json:"extra,omitempty" bson:"extra,omitempty"`
	// contains filtered or unexported fields
}

type DependencySetting

type DependencySetting struct {
	Id           primitive.ObjectID `json:"_id" bson:"_id"`
	Key          string             `json:"key" bson:"key"`
	Name         string             `json:"name" bson:"name"`
	Description  string             `json:"description" bson:"description"`
	Enabled      bool               `json:"enabled" bson:"enabled"`
	Cmd          string             `json:"cmd" bson:"cmd"`
	Proxy        string             `json:"proxy" bson:"proxy"`
	LastUpdateTs time.Time          `json:"last_update_ts" bson:"last_update_ts"`
}

func (*DependencySetting) GetId

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

func (*DependencySetting) SetId

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

type DependencySettingList

type DependencySettingList []DependencySetting

func (*DependencySettingList) GetModels

func (l *DependencySettingList) GetModels() (res []interfaces.Model)

type DependencySettingV2

type DependencySettingV2 struct {
	BaseModelV2[DependencySetting] `bson:",inline"`
	Key                            string    `json:"key" bson:"key"`
	Name                           string    `json:"name" bson:"name"`
	Description                    string    `json:"description" bson:"description"`
	Enabled                        bool      `json:"enabled" bson:"enabled"`
	Cmd                            string    `json:"cmd" bson:"cmd"`
	Proxy                          string    `json:"proxy" bson:"proxy"`
	LastUpdateTs                   time.Time `json:"last_update_ts" bson:"last_update_ts"`
	// contains filtered or unexported fields
}

type Env

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

type Environment

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

func (*Environment) GetId

func (e *Environment) GetId() (id primitive.ObjectID)

func (*Environment) GetKey

func (e *Environment) GetKey() (key string)

func (*Environment) GetValue

func (e *Environment) GetValue() (value string)

func (*Environment) SetId

func (e *Environment) SetId(id primitive.ObjectID)

func (*Environment) SetKey

func (e *Environment) SetKey(key string)

func (*Environment) SetValue

func (e *Environment) SetValue(value string)

type EnvironmentList

type EnvironmentList []Environment

func (*EnvironmentList) GetModels

func (l *EnvironmentList) GetModels() (res []interfaces.Model)

type EnvironmentV2

type EnvironmentV2 struct {
	BaseModelV2[EnvironmentV2] `bson:",inline"`
	Key                        string `json:"key" bson:"key"`
	Value                      string `json:"value" bson:"value"`
	// contains filtered or unexported fields
}

type ExtraValue

type ExtraValue struct {
	Id       primitive.ObjectID `json:"_id" bson:"_id"`
	ObjectId primitive.ObjectID `json:"oid" bson:"oid"`
	Model    string             `json:"model" bson:"m"`
	Type     string             `json:"type" bson:"t"`
	Value    interface{}        `json:"value" bson:"v"`
}

func (*ExtraValue) GetId

func (ev *ExtraValue) GetId() (id primitive.ObjectID)

func (*ExtraValue) GetModel

func (ev *ExtraValue) GetModel() (m string)

func (*ExtraValue) GetObjectId

func (ev *ExtraValue) GetObjectId() (oid primitive.ObjectID)

func (*ExtraValue) GetType

func (ev *ExtraValue) GetType() (t string)

func (*ExtraValue) GetValue

func (ev *ExtraValue) GetValue() (v interface{})

func (*ExtraValue) SetId

func (ev *ExtraValue) SetId(id primitive.ObjectID)

func (*ExtraValue) SetModel

func (ev *ExtraValue) SetModel(m string)

func (*ExtraValue) SetObjectId

func (ev *ExtraValue) SetObjectId(oid primitive.ObjectID)

func (*ExtraValue) SetType

func (ev *ExtraValue) SetType(t string)

func (*ExtraValue) SetValue

func (ev *ExtraValue) SetValue(v interface{})

type ExtraValueList

type ExtraValueList []ExtraValue

func (*ExtraValueList) GetModels

func (l *ExtraValueList) GetModels() (res []interfaces.Model)

type Git

type Git struct {
	Id            primitive.ObjectID `json:"_id" bson:"_id"`
	Url           string             `json:"url" bson:"url"`
	AuthType      string             `json:"auth_type" bson:"auth_type"`
	Username      string             `json:"username" bson:"username"`
	Password      string             `json:"password" bson:"password"`
	CurrentBranch string             `json:"current_branch" bson:"current_branch"`
	AutoPull      bool               `json:"auto_pull" bson:"auto_pull"`
}

func (*Git) GetAuthType

func (g *Git) GetAuthType() (authType string)

func (*Git) GetAutoPull

func (g *Git) GetAutoPull() (autoPull bool)

func (*Git) GetCurrentBranch

func (g *Git) GetCurrentBranch() (currentBranch string)

func (*Git) GetId

func (g *Git) GetId() (id primitive.ObjectID)

func (*Git) GetPassword

func (g *Git) GetPassword() (password string)

func (*Git) GetUrl

func (g *Git) GetUrl() (url string)

func (*Git) GetUsername

func (g *Git) GetUsername() (username string)

func (*Git) SetAuthType

func (g *Git) SetAuthType(authType string)

func (*Git) SetAutoPull

func (g *Git) SetAutoPull(autoPull bool)

func (*Git) SetCurrentBranch

func (g *Git) SetCurrentBranch(currentBranch string)

func (*Git) SetId

func (g *Git) SetId(id primitive.ObjectID)

func (*Git) SetPassword

func (g *Git) SetPassword(password string)

func (*Git) SetUrl

func (g *Git) SetUrl(url string)

func (*Git) SetUsername

func (g *Git) SetUsername(username string)

type GitList

type GitList []Git

func (*GitList) GetModels

func (l *GitList) GetModels() (res []interfaces.Model)

type GitV2

type GitV2 struct {
	BaseModelV2[GitV2] `bson:",inline"`
	Url                string `json:"url" bson:"url"`
	AuthType           string `json:"auth_type" bson:"auth_type"`
	Username           string `json:"username" bson:"username"`
	Password           string `json:"password" bson:"password"`
	CurrentBranch      string `json:"current_branch" bson:"current_branch"`
	AutoPull           bool   `json:"auto_pull" bson:"auto_pull"`
	// contains filtered or unexported fields
}

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 JobList

type JobList []Job

func (*JobList) GetModels

func (l *JobList) GetModels() (res []interfaces.Model)

type ModelListMap

type ModelListMap struct {
	Artifacts          ArtifactList
	Tags               TagList
	Nodes              NodeList
	Projects           ProjectList
	Spiders            SpiderList
	Tasks              TaskList
	Jobs               JobList
	Schedules          ScheduleList
	Users              UserList
	Settings           SettingList
	Tokens             TokenList
	Variables          VariableList
	TaskQueueItems     TaskQueueItemList
	TaskStats          TaskStatList
	SpiderStats        SpiderStatList
	DataSources        DataSourceList
	DataCollections    DataCollectionList
	Results            ResultList
	Passwords          PasswordList
	ExtraValues        ExtraValueList
	Gits               GitList
	Roles              RoleList
	UserRoles          UserRoleList
	PermissionList     PermissionList
	RolePermissionList RolePermissionList
	Environments       EnvironmentList
	DependencySettings DependencySettingList
}

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
	SpiderStat        SpiderStat
	DataSource        DataSource
	DataCollection    DataCollection
	Result            Result
	Password          Password
	ExtraValue        ExtraValue
	Git               Git
	Role              Role
	UserRole          UserRole
	Permission        Permission
	RolePermission    RolePermission
	Environment       Environment
	DependencySetting DependencySetting
}

func NewModelMap

func NewModelMap() (m *ModelMap)

type Node

type Node struct {
	Id               primitive.ObjectID `json:"_id" bson:"_id"`
	Key              string             `json:"key" bson:"key"`
	Name             string             `json:"name" bson:"name"`
	Ip               string             `json:"ip" bson:"ip"`
	Port             string             `json:"port" bson:"port"`
	Mac              string             `json:"mac" bson:"mac"`
	Hostname         string             `json:"hostname" bson:"hostname"`
	Description      string             `json:"description" bson:"description"`
	IsMaster         bool               `json:"is_master" bson:"is_master"`
	Status           string             `json:"status" bson:"status"`
	Enabled          bool               `json:"enabled" bson:"enabled"`
	Active           bool               `json:"active" bson:"active"`
	ActiveTs         time.Time          `json:"active_ts" bson:"active_ts"`
	AvailableRunners int                `json:"available_runners" bson:"available_runners"`
	MaxRunners       int                `json:"max_runners" bson:"max_runners"`
}

func (*Node) DecrementAvailableRunners

func (n *Node) DecrementAvailableRunners()

func (*Node) GetActive

func (n *Node) GetActive() (active bool)

func (*Node) GetAvailableRunners

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

func (*Node) GetDescription

func (n *Node) GetDescription() (description string)

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) GetName

func (n *Node) GetName() (name string)

func (*Node) GetStatus

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

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) SetDescription

func (n *Node) SetDescription(description string)

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) SetName

func (n *Node) SetName(name string)

func (*Node) SetStatus

func (n *Node) SetStatus(status string)

type NodeList

type NodeList []Node

func (*NodeList) GetModels

func (l *NodeList) GetModels() (res []interfaces.Model)

type NodeV2

type NodeV2 struct {
	BaseModelV2[NodeV2] `bson:",inline"`
	Key                 string    `json:"key" bson:"key"`
	Name                string    `json:"name" bson:"name"`
	Ip                  string    `json:"ip" bson:"ip"`
	Port                string    `json:"port" bson:"port"`
	Mac                 string    `json:"mac" bson:"mac"`
	Hostname            string    `json:"hostname" bson:"hostname"`
	Description         string    `json:"description" bson:"description"`
	IsMaster            bool      `json:"is_master" bson:"is_master"`
	Status              string    `json:"status" bson:"status"`
	Enabled             bool      `json:"enabled" bson:"enabled"`
	Active              bool      `json:"active" bson:"active"`
	ActiveAt            time.Time `json:"active_at" bson:"active_ts"`
	AvailableRunners    int       `json:"available_runners" bson:"available_runners"`
	MaxRunners          int       `json:"max_runners" bson:"max_runners"`
	// contains filtered or unexported fields
}

type NotificationSettingMail

type NotificationSettingMail struct {
	Server         string `json:"server" bson:"server"`
	Port           string `json:"port,omitempty" bson:"port,omitempty"`
	User           string `json:"user,omitempty" bson:"user,omitempty"`
	Password       string `json:"password,omitempty" bson:"password,omitempty"`
	SenderEmail    string `json:"sender_email,omitempty" bson:"sender_email,omitempty"`
	SenderIdentity string `json:"sender_identity,omitempty" bson:"sender_identity,omitempty"`
	To             string `json:"to,omitempty" bson:"to,omitempty"`
	Cc             string `json:"cc,omitempty" bson:"cc,omitempty"`
}

type NotificationSettingMobile

type NotificationSettingMobile struct {
	Webhook string `json:"webhook" bson:"webhook"`
}

type NotificationSettingV2

type NotificationSettingV2 struct {
	Id          primitive.ObjectID        `json:"_id" bson:"_id"`
	Type        string                    `json:"type" bson:"type"`
	Name        string                    `json:"name" bson:"name"`
	Description string                    `json:"description" bson:"description"`
	Enabled     bool                      `json:"enabled" bson:"enabled"`
	Global      bool                      `json:"global" bson:"global"`
	Title       string                    `json:"title,omitempty" bson:"title,omitempty"`
	Template    string                    `json:"template,omitempty" bson:"template,omitempty"`
	TaskTrigger string                    `json:"task_trigger" bson:"task_trigger"`
	Mail        NotificationSettingMail   `json:"mail,omitempty" bson:"mail,omitempty"`
	Mobile      NotificationSettingMobile `json:"mobile,omitempty" bson:"mobile,omitempty"`
}

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 PasswordList

type PasswordList []Password

func (*PasswordList) GetModels

func (l *PasswordList) GetModels() (res []interfaces.Model)

type Permission

type Permission struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Key         string             `json:"key" bson:"key"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description"`
	Type        string             `json:"type" bson:"type"`
	Target      []string           `json:"target" bson:"target"`
	Allow       []string           `json:"allow" bson:"allow"`
	Deny        []string           `json:"deny" bson:"deny"`
}

func (*Permission) GetAllow

func (p *Permission) GetAllow() (include []string)

func (*Permission) GetDeny

func (p *Permission) GetDeny() (exclude []string)

func (*Permission) GetDescription

func (p *Permission) GetDescription() (description string)

func (*Permission) GetId

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

func (*Permission) GetKey

func (p *Permission) GetKey() (key string)

func (*Permission) GetName

func (p *Permission) GetName() (name string)

func (*Permission) GetTarget

func (p *Permission) GetTarget() (target []string)

func (*Permission) GetType

func (p *Permission) GetType() (t string)

func (*Permission) SetAllow

func (p *Permission) SetAllow(include []string)

func (*Permission) SetDeny

func (p *Permission) SetDeny(exclude []string)

func (*Permission) SetDescription

func (p *Permission) SetDescription(description string)

func (*Permission) SetId

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

func (*Permission) SetKey

func (p *Permission) SetKey(key string)

func (*Permission) SetName

func (p *Permission) SetName(name string)

func (*Permission) SetTarget

func (p *Permission) SetTarget(target []string)

func (*Permission) SetType

func (p *Permission) SetType(t string)

type PermissionList

type PermissionList []Permission

func (*PermissionList) GetModels

func (l *PermissionList) GetModels() (res []interfaces.Model)

type PermissionV2

type PermissionV2 struct {
	BaseModelV2[PermissionV2] `bson:",inline"`
	Key                       string   `json:"key" bson:"key"`
	Name                      string   `json:"name" bson:"name"`
	Description               string   `json:"description" bson:"description"`
	Type                      string   `json:"type" bson:"type"`
	Target                    []string `json:"target" bson:"target"`
	Allow                     []string `json:"allow" bson:"allow"`
	Deny                      []string `json:"deny" bson:"deny"`
	// contains filtered or unexported fields
}

type Project

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

func (*Project) GetDescription

func (p *Project) GetDescription() (description string)

func (*Project) GetId

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

func (*Project) GetName

func (p *Project) GetName() (name string)

func (*Project) SetDescription

func (p *Project) SetDescription(description string)

func (*Project) SetId

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

func (*Project) SetName

func (p *Project) SetName(name string)

type ProjectList

type ProjectList []Project

func (*ProjectList) GetModels

func (l *ProjectList) GetModels() (res []interfaces.Model)

type ProjectV2

type ProjectV2 struct {
	BaseModelV2[ProjectV2] `bson:",inline"`
	Name                   string `json:"name" bson:"name"`
	Description            string `json:"description" bson:"description"`
	Spiders                int    `json:"spiders" bson:"-"`
	// contains filtered or unexported fields
}

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 ResultList

type ResultList []Result

func (*ResultList) GetModels

func (l *ResultList) GetModels() (res []interfaces.Model)

type Role

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

func (*Role) GetDescription

func (r *Role) GetDescription() (description string)

func (*Role) GetId

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

func (*Role) GetKey

func (r *Role) GetKey() (key string)

func (*Role) GetName

func (r *Role) GetName() (name string)

func (*Role) SetDescription

func (r *Role) SetDescription(description string)

func (*Role) SetId

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

func (*Role) SetKey

func (r *Role) SetKey(key string)

func (*Role) SetName

func (r *Role) SetName(name string)

type RoleList

type RoleList []Role

func (*RoleList) GetModels

func (l *RoleList) GetModels() (res []interfaces.Model)

type RolePermission

type RolePermission struct {
	Id           primitive.ObjectID `json:"_id" bson:"_id"`
	RoleId       primitive.ObjectID `json:"role_id" bson:"role_id"`
	PermissionId primitive.ObjectID `json:"permission_id" bson:"permission_id"`
}

func (*RolePermission) GetId

func (ur *RolePermission) GetId() (id primitive.ObjectID)

func (*RolePermission) SetId

func (ur *RolePermission) SetId(id primitive.ObjectID)

type RolePermissionList

type RolePermissionList []RolePermission

func (*RolePermissionList) GetModels

func (l *RolePermissionList) GetModels() (res []interfaces.Model)

type RolePermissionV2

type RolePermissionV2 struct {
	BaseModelV2[RolePermissionV2] `bson:",inline"`
	RoleId                        primitive.ObjectID `json:"role_id" bson:"role_id"`
	PermissionId                  primitive.ObjectID `json:"permission_id" bson:"permission_id"`
	// contains filtered or unexported fields
}

type RoleV2

type RoleV2 struct {
	BaseModelV2[RoleV2] `bson:",inline"`
	Key                 string `json:"key" bson:"key"`
	Name                string `json:"name" bson:"name"`
	Description         string `json:"description" bson:"description"`
	// contains filtered or unexported fields
}

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"`
	Priority    int                  `json:"priority" bson:"priority"`
	Enabled     bool                 `json:"enabled" bson:"enabled"`
	UserId      primitive.ObjectID   `json:"user_id" bson:"user_id"`
}

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) 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) 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 ScheduleList

type ScheduleList []Schedule

func (*ScheduleList) GetModels

func (l *ScheduleList) GetModels() (res []interfaces.Model)

type ScheduleV2

type ScheduleV2 struct {
	BaseModelV2[ScheduleV2] `bson:",inline"`
	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"`
	Priority                int                  `json:"priority" bson:"priority"`
	Enabled                 bool                 `json:"enabled" bson:"enabled"`
	UserId                  primitive.ObjectID   `json:"user_id" bson:"user_id"`
	// contains filtered or unexported fields
}

type Setting

type Setting struct {
	Id    primitive.ObjectID `json:"_id" bson:"_id"`
	Key   string             `json:"key" bson:"key"`
	Value bson.M             `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 SettingList

type SettingList []Setting

func (*SettingList) GetModels

func (l *SettingList) GetModels() (res []interfaces.Model)

type SettingV2

type SettingV2 struct {
	BaseModelV2[SettingV2] `bson:",inline"`
	Key                    string `json:"key" bson:"key"`
	Value                  bson.M `json:"value" bson:"value"`
	// contains filtered or unexported fields
}

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
	DataSourceId primitive.ObjectID   `json:"data_source_id" bson:"data_source_id"` // data source id
	DataSource   *DataSource          `json:"data_source,omitempty" bson:"-"`       // data source
	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
	Stat         *SpiderStat          `json:"stat,omitempty" bson:"-"`

	// execution
	Cmd         string `json:"cmd" bson:"cmd"`     // execute command
	Param       string `json:"param" bson:"param"` // default task param
	Priority    int    `json:"priority" bson:"priority"`
	AutoInstall bool   `json:"auto_install" bson:"auto_install"`

	// settings
	IncrementalSync bool `json:"incremental_sync" bson:"incremental_sync"` // whether to incrementally sync files
}

func (*Spider) GetAutoInstall

func (s *Spider) GetAutoInstall() (autoInstall bool)

func (*Spider) GetCmd

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

func (*Spider) GetColId

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

func (*Spider) GetDescription

func (s *Spider) GetDescription() (description string)

func (*Spider) GetId

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

func (*Spider) GetIncrementalSync

func (s *Spider) GetIncrementalSync() (incrementalSync bool)

func (*Spider) GetMode

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

func (*Spider) GetName

func (s *Spider) GetName() (name string)

func (*Spider) GetNodeIds

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

func (*Spider) GetParam

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

func (*Spider) GetPriority

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

func (*Spider) GetType

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

func (*Spider) SetAutoInstall

func (s *Spider) SetAutoInstall(autoInstall bool)

func (*Spider) SetCmd

func (s *Spider) SetCmd(cmd string)

func (*Spider) SetColId

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

func (*Spider) SetDescription

func (s *Spider) SetDescription(description string)

func (*Spider) SetId

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

func (*Spider) SetIncrementalSync

func (s *Spider) SetIncrementalSync(incrementalSync bool)

func (*Spider) SetMode

func (s *Spider) SetMode(mode string)

func (*Spider) SetName

func (s *Spider) SetName(name string)

func (*Spider) SetNodeIds

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

func (*Spider) SetParam

func (s *Spider) SetParam(param string)

func (*Spider) SetPriority

func (s *Spider) SetPriority(p int)

type SpiderList

type SpiderList []Spider

func (*SpiderList) GetModels

func (l *SpiderList) GetModels() (res []interfaces.Model)

type SpiderStat

type SpiderStat struct {
	Id                     primitive.ObjectID `json:"_id" bson:"_id"`
	LastTaskId             primitive.ObjectID `json:"last_task_id" bson:"last_task_id,omitempty"`
	LastTask               *Task              `json:"last_task,omitempty" bson:"-"`
	Tasks                  int                `json:"tasks" bson:"tasks"`
	Results                int                `json:"results" bson:"results"`
	WaitDuration           int64              `json:"wait_duration" bson:"wait_duration,omitempty"`       // in second
	RuntimeDuration        int64              `json:"runtime_duration" bson:"runtime_duration,omitempty"` // in second
	TotalDuration          int64              `json:"total_duration" bson:"total_duration,omitempty"`     // 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 SpiderStatList

type SpiderStatList []SpiderStat

func (*SpiderStatList) GetModels

func (l *SpiderStatList) GetModels() (res []interfaces.Model)

type SpiderStatV2

type SpiderStatV2 struct {
	BaseModelV2[SpiderStatV2] `bson:",inline"`
	LastTaskId                primitive.ObjectID `json:"last_task_id" bson:"last_task_id,omitempty"`
	LastTask                  *TaskV2            `json:"last_task,omitempty" bson:"-"`
	Tasks                     int                `json:"tasks" bson:"tasks"`
	Results                   int                `json:"results" bson:"results"`
	WaitDuration              int64              `json:"wait_duration" bson:"wait_duration,omitempty"`       // in second
	RuntimeDuration           int64              `json:"runtime_duration" bson:"runtime_duration,omitempty"` // in second
	TotalDuration             int64              `json:"total_duration" bson:"total_duration,omitempty"`     // 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
	// contains filtered or unexported fields
}

type SpiderV2

type SpiderV2 struct {
	BaseModelV2[SpiderV2] `bson:",inline"`
	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
	DataSourceId          primitive.ObjectID   `json:"data_source_id" bson:"data_source_id"` // data source id
	DataSource            *DataSourceV2        `json:"data_source,omitempty" bson:"-"`       // data source
	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
	Stat                  *SpiderStatV2        `json:"stat,omitempty" bson:"-"`

	// execution
	Cmd         string `json:"cmd" bson:"cmd"`     // execute command
	Param       string `json:"param" bson:"param"` // default task param
	Priority    int    `json:"priority" bson:"priority"`
	AutoInstall bool   `json:"auto_install" bson:"auto_install"`

	// settings
	IncrementalSync bool `json:"incremental_sync" bson:"incremental_sync"` // whether to incrementally sync files
	// contains filtered or unexported fields
}

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 TagList

type TagList []Tag

func (*TagList) GetModels

func (l *TagList) GetModels() (res []interfaces.Model)

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
	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:"-"`
	HasSub     bool                 `json:"has_sub" json:"has_sub"` // whether to have sub-tasks
	SubTasks   []Task               `json:"sub_tasks,omitempty" bson:"-"`
	Spider     *Spider              `json:"spider,omitempty" bson:"-"`
	UserId     primitive.ObjectID   `json:"-" bson:"-"`
	CreateTs   time.Time            `json:"create_ts" bson:"create_ts"`
}

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) GetParam

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

func (*Task) GetPid

func (t *Task) GetPid() (pid int)

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) GetUserId

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

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) SetPid

func (t *Task) SetPid(pid int)

func (*Task) SetStatus

func (t *Task) SetStatus(status string)

func (*Task) SetUserId

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

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 TaskList

type TaskList []Task

func (*TaskList) GetModels

func (l *TaskList) GetModels() (res []interfaces.Model)

type TaskQueueItem

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

func (*TaskQueueItem) GetId

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

func (*TaskQueueItem) SetId

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

type TaskQueueItemList

type TaskQueueItemList []TaskQueueItem

func (*TaskQueueItemList) GetModels

func (l *TaskQueueItemList) GetModels() (res []interfaces.Model)

type TaskQueueItemV2

type TaskQueueItemV2 struct {
	BaseModelV2[TaskQueueItemV2] `bson:",inline"`
	Priority                     int                `json:"p" bson:"p"`
	NodeId                       primitive.ObjectID `json:"nid,omitempty" bson:"nid,omitempty"`
	// contains filtered or unexported fields
}

type TaskStat

type TaskStat struct {
	Id              primitive.ObjectID `json:"_id" bson:"_id"`
	CreateTs        time.Time          `json:"create_ts" bson:"create_ts,omitempty"`
	StartTs         time.Time          `json:"start_ts" bson:"start_ts,omitempty"`
	EndTs           time.Time          `json:"end_ts" bson:"end_ts,omitempty"`
	WaitDuration    int64              `json:"wait_duration" bson:"wait_duration,omitempty"`       // in millisecond
	RuntimeDuration int64              `json:"runtime_duration" bson:"runtime_duration,omitempty"` // in millisecond
	TotalDuration   int64              `json:"total_duration" bson:"total_duration,omitempty"`     // in millisecond
	ResultCount     int64              `json:"result_count" bson:"result_count"`
	ErrorLogCount   int64              `json:"error_log_count" bson:"error_log_count"`
}

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 TaskStatList

type TaskStatList []TaskStat

func (*TaskStatList) GetModels

func (l *TaskStatList) GetModels() (res []interfaces.Model)

type TaskStatV2

type TaskStatV2 struct {
	BaseModelV2[TaskStatV2] `bson:",inline"`
	CreateTs                time.Time `json:"create_ts" bson:"create_ts,omitempty"`
	StartTs                 time.Time `json:"start_ts" bson:"start_ts,omitempty"`
	EndTs                   time.Time `json:"end_ts" bson:"end_ts,omitempty"`
	WaitDuration            int64     `json:"wait_duration" bson:"wait_duration,omitempty"`       // in millisecond
	RuntimeDuration         int64     `json:"runtime_duration" bson:"runtime_duration,omitempty"` // in millisecond
	TotalDuration           int64     `json:"total_duration" bson:"total_duration,omitempty"`     // in millisecond
	ResultCount             int64     `json:"result_count" bson:"result_count"`
	ErrorLogCount           int64     `json:"error_log_count" bson:"error_log_count"`
	// contains filtered or unexported fields
}

type TaskV2

type TaskV2 struct {
	BaseModelV2[TaskV2] `bson:",inline"`
	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"`
	Type                string               `json:"type" bson:"type"`
	Mode                string               `json:"mode" bson:"mode"`
	NodeIds             []primitive.ObjectID `json:"node_ids" bson:"node_ids"`
	ParentId            primitive.ObjectID   `json:"parent_id" bson:"parent_id"`
	Priority            int                  `json:"priority" bson:"priority"`
	Stat                *TaskStatV2          `json:"stat,omitempty" bson:"-"`
	HasSub              bool                 `json:"has_sub" json:"has_sub"`
	SubTasks            []TaskV2             `json:"sub_tasks,omitempty" bson:"-"`
	Spider              *SpiderV2            `json:"spider,omitempty" bson:"-"`
	UserId              primitive.ObjectID   `json:"-" bson:"-"`
	CreateTs            time.Time            `json:"create_ts" bson:"create_ts"`
	// contains filtered or unexported fields
}

type TestModel

type TestModel struct {
	BaseModelV2[TestModel] `bson:",inline"`
	Name                   string `json:"name" bson:"name"`
	// contains filtered or unexported fields
}

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 TokenList

type TokenList []Token

func (*TokenList) GetModels

func (l *TokenList) GetModels() (res []interfaces.Model)

type TokenV2

type TokenV2 struct {
	BaseModelV2[TokenV2] `bson:",inline"`
	Name                 string `json:"name" bson:"name"`
	Token                string `json:"token" bson:"token"`
	// contains filtered or unexported fields
}

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"`
}

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 UserList

type UserList []User

func (*UserList) GetModels

func (l *UserList) GetModels() (res []interfaces.Model)

type UserRole

type UserRole struct {
	Id     primitive.ObjectID `json:"_id" bson:"_id"`
	RoleId primitive.ObjectID `json:"role_id" bson:"role_id"`
	UserId primitive.ObjectID `json:"user_id" bson:"user_id"`
}

func (*UserRole) GetId

func (ur *UserRole) GetId() (id primitive.ObjectID)

func (*UserRole) SetId

func (ur *UserRole) SetId(id primitive.ObjectID)

type UserRoleList

type UserRoleList []UserRole

func (*UserRoleList) GetModels

func (l *UserRoleList) GetModels() (res []interfaces.Model)

type UserRoleV2

type UserRoleV2 struct {
	BaseModelV2[UserRoleV2] `bson:",inline"`
	RoleId                  primitive.ObjectID `json:"role_id" bson:"role_id"`
	UserId                  primitive.ObjectID `json:"user_id" bson:"user_id"`
	// contains filtered or unexported fields
}

type UserV2

type UserV2 struct {
	BaseModelV2[UserV2] `bson:",inline"`
	Username            string `json:"username" bson:"username"`
	Password            string `json:"-,omitempty" bson:"password"`
	Role                string `json:"role" bson:"role"`
	Email               string `json:"email" bson:"email"`
	// contains filtered or unexported fields
}

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)

type VariableList

type VariableList []Variable

func (*VariableList) GetModels

func (l *VariableList) GetModels() (res []interfaces.Model)

type VariableV2

type VariableV2 struct {
	BaseModelV2[VariableV2] `bson:",inline"`
	Key                     string `json:"key" bson:"key"`
	Value                   string `json:"value" bson:"value"`
	Remark                  string `json:"remark" bson:"remark"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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