Files
crawlab/core/models/models/variable.go
2024-06-14 15:42:50 +08:00

32 lines
667 B
Go

package models
import (
"github.com/crawlab-team/crawlab/core/interfaces"
"go.mongodb.org/mongo-driver/bson/primitive"
)
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 (v *Variable) GetId() (id primitive.ObjectID) {
return v.Id
}
func (v *Variable) SetId(id primitive.ObjectID) {
v.Id = id
}
type VariableList []Variable
func (l *VariableList) GetModels() (res []interfaces.Model) {
for i := range *l {
d := (*l)[i]
res = append(res, &d)
}
return res
}