Skip to content

Commit

Permalink
feat: added fields to spider
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Nov 26, 2023
1 parent 30c34bd commit 2b9747e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions interfaces/model_spider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ type Spider interface {
SetColId(id primitive.ObjectID)
GetIncrementalSync() (incrementalSync bool)
SetIncrementalSync(incrementalSync bool)
GetAutoInstall() (autoInstall bool)
SetAutoInstall(autoInstall bool)
}
15 changes: 12 additions & 3 deletions models/models/spider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ type Spider struct {
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"`
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
Expand Down Expand Up @@ -117,6 +118,14 @@ func (s *Spider) SetIncrementalSync(incrementalSync bool) {
s.IncrementalSync = incrementalSync
}

func (s *Spider) GetAutoInstall() (autoInstall bool) {
return s.AutoInstall
}

func (s *Spider) SetAutoInstall(autoInstall bool) {
s.AutoInstall = autoInstall
}

type SpiderList []Spider

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

0 comments on commit 2b9747e

Please sign in to comment.