mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
31 lines
658 B
Go
31 lines
658 B
Go
package models
|
|
|
|
import (
|
|
"github.com/crawlab-team/crawlab/core/interfaces"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
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 (t *TaskQueueItem) GetId() (id primitive.ObjectID) {
|
|
return t.Id
|
|
}
|
|
|
|
func (t *TaskQueueItem) SetId(id primitive.ObjectID) {
|
|
t.Id = id
|
|
}
|
|
|
|
type TaskQueueItemList []TaskQueueItem
|
|
|
|
func (l *TaskQueueItemList) GetModels() (res []interfaces.Model) {
|
|
for i := range *l {
|
|
d := (*l)[i]
|
|
res = append(res, &d)
|
|
}
|
|
return res
|
|
}
|