model

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadJsonSchema added in v0.1.1

func LoadJsonSchema(name string, i interface{}) (err error)

func SetAccTasks added in v0.1.23

func SetAccTasks(ctx context.Context, db *mongo.Database) (err error)

func SetBuilders added in v0.2.5

func SetBuilders(ctx context.Context, db *mongo.Database) (err error)

func SetCategories added in v0.1.8

func SetCategories(ctx context.Context, db *mongo.Database) (err error)

func SetClusters added in v0.1.8

func SetClusters(ctx context.Context, db *mongo.Database) (err error)

func SetEndpoints added in v0.2.1

func SetEndpoints(ctx context.Context, db *mongo.Database) (err error)

func SetImessages added in v0.1.8

func SetImessages(ctx context.Context, db *mongo.Database) (err error)

func SetLogsetImessages added in v0.1.16

func SetLogsetImessages(ctx context.Context, db *mongo.Database) (err error)

func SetLogsetJobs added in v0.1.8

func SetLogsetJobs(ctx context.Context, db *mongo.Database) (err error)

func SetLogsetLogins added in v0.1.16

func SetLogsetLogins(ctx context.Context, db *mongo.Database) (err error)

func SetLogsetOperates added in v0.1.8

func SetLogsetOperates(ctx context.Context, db *mongo.Database) (err error)

func SetPictures added in v0.1.8

func SetPictures(ctx context.Context, db *mongo.Database) (err error)

func SetProjects added in v0.1.8

func SetProjects(ctx context.Context, db *mongo.Database) (err error)

func SetQueues added in v0.1.8

func SetQueues(ctx context.Context, db *mongo.Database) (err error)

func SetUsers added in v0.1.8

func SetUsers(ctx context.Context, db *mongo.Database) (err error)

func SetVideos added in v0.1.8

func SetVideos(ctx context.Context, db *mongo.Database) (err error)

func SetWorkflows added in v0.1.8

func SetWorkflows(ctx context.Context, db *mongo.Database) (err error)

Types

type AccTask added in v0.1.23

type AccTask struct {
	Kind   string `bson:"kind" json:"kind"`
	Source string `bson:"source" json:"source"`
	Target string `bson:"target" json:"target"`
}

type Builder added in v0.2.5

type Builder struct {
	ID          primitive.ObjectID  `bson:"_id,omitempty" json:"_id"`
	Project     primitive.ObjectID  `bson:"project" json:"project"`
	Parent      *primitive.ObjectID `bson:"parent" json:"parent"`
	Name        string              `bson:"name" json:"name"`
	Kind        string              `bson:"kind" json:"kind"`
	Icon        string              `bson:"icon" json:"icon"`
	Description string              `bson:"description" json:"description"`
	Schema      *BuilderSchema      `bson:"schema" json:"schema"`
	Status      bool                `bson:"status" json:"status"`
	Sort        int64               `bson:"sort" json:"sort"`
	CreateTime  time.Time           `bson:"create_time" json:"create_time"`
	UpdateTime  time.Time           `bson:"update_time" json:"update_time"`
}

type BuilderSchema added in v0.2.5

type BuilderSchema struct {
	Key    string               `bson:"key" json:"key"`
	Fields []BuilderSchemaField `bson:"fields" json:"fields"`
	Rules  []BuilderSchemaRule  `bson:"rules" json:"rules"`
}

type BuilderSchemaField added in v0.2.5

type BuilderSchemaField struct {
	Name        string       `bson:"name" json:"name"`
	Key         string       `bson:"key" json:"key"`
	Type        string       `bson:"type" json:"type"`
	Required    bool         `bson:"required" json:"required"`
	Visible     bool         `bson:"visible" json:"visible"`
	DefaultTo   interface{}  `bson:"default_to" json:"default_to"`
	Placeholder string       `bson:"placeholder" json:"placeholder"`
	Description string       `bson:"description" json:"description"`
	Option      *FieldOption `bson:"option,omitempty" json:"option,omitempty"`
}

type BuilderSchemaRule added in v0.2.5

type BuilderSchemaRule struct {
	Logic      string          `bson:"logic" json:"logic"`
	Conditions []RuleCondition `bson:"conditions" json:"conditions"`
	Keys       []string        `bson:"keys" json:"keys"`
}

type Category added in v0.1.0

type Category struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Type       string             `bson:"type" json:"type"`
	Name       string             `bson:"name" json:"name"`
	Sort       int64              `bson:"sort" json:"sort"`
	CreateTime time.Time          `bson:"create_time" json:"create_time"`
	UpdateTime time.Time          `bson:"update_time" json:"update_time"`
}

type Cluster added in v0.1.0

type Cluster struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name       string             `bson:"name" json:"name"`
	Kind       string             `bson:"kind" json:"kind"`
	Config     string             `bson:"config" json:"config"`
	Admin      bool               `bson:"admin" json:"admin"`
	CreateTime time.Time          `bson:"create_time" json:"create_time"`
	UpdateTime time.Time          `bson:"update_time" json:"update_time"`
}

type ClusterKubeConfig added in v0.1.0

type ClusterKubeConfig struct {
	Host     string `json:"host"`
	CAData   string `json:"ca_data"`
	CertData string `json:"cert_data"`
	KeyData  string `json:"key_data"`
}

type Endpoint added in v0.2.1

type Endpoint struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name       string             `bson:"name" json:"name"`
	Kind       string             `bson:"kind" json:"kind"`
	Schedule   *EndpointSchedule  `bson:"schedule" json:"schedule"`
	Emqx       *EndpointEmqx      `bson:"emqx" json:"emqx"`
	CreateTime time.Time          `bson:"create_time" json:"create_time"`
	UpdateTime time.Time          `bson:"update_time" json:"update_time"`
}

type EndpointEmqx added in v0.2.1

type EndpointEmqx struct {
	Host      string `bson:"host" json:"host"`
	ApiKey    string `bson:"api_key" json:"api_key"`
	SecretKey string `bson:"secret_key" json:"secret_key"`
}

type EndpointSchedule added in v0.2.1

type EndpointSchedule struct {
	Node string `bson:"node" json:"node"`
}

type FieldOption added in v0.2.5

type FieldOption struct {
	// Type: number
	Max     int64 `bson:"max" json:"max"`
	Min     int64 `bson:"min" json:"min"`
	Decimal int64 `bson:"decimal" json:"decimal"`
	// Type: date,dates
	Time bool `bson:"time" json:"time"`
	// Type: radio,checkbox,select
	Enums []FieldOptionEnum `bson:"enums" json:"enums"`
	// Type: ref
	Ref    string   `bson:"ref" json:"ref"`
	RefKey []string `bson:"ref_key" json:"ref_key"`
	// Type: manual
	Component string `bson:"component" json:"component"`
	// Type: other
	Multiple bool `bson:"multiple" json:"multiple"`
}

type FieldOptionEnum added in v0.2.5

type FieldOptionEnum struct {
	Label string      `bson:"label" json:"label"`
	Value interface{} `bson:"value" json:"value"`
}

type Imessage added in v0.1.0

type Imessage struct {
	ID          primitive.ObjectID   `bson:"_id,omitempty" json:"_id"`
	Topic       string               `bson:"topic" json:"topic"`
	Rule        string               `bson:"rule" json:"rule"`
	Description string               `bson:"description" json:"description"`
	Projects    []primitive.ObjectID `bson:"projects" json:"projects"`
	CreateTime  time.Time            `bson:"create_time" json:"create_time" farker:"-"`
	UpdateTime  time.Time            `bson:"update_time" json:"update_time" farker:"-"`
}

type LogsetLogin added in v0.1.16

type LogsetLogin struct {
	Timestamp time.Time           `bson:"timestamp" json:"timestamp"`
	Metadata  LogsetLoginMetadata `bson:"metadata" json:"metadata"`
	UserAgent string              `bson:"user_agent" json:"user_agent"`
	Detail    interface{}         `bson:"detail" json:"detail"`
}

func NewLogsetLogin added in v0.1.16

func NewLogsetLogin(uid primitive.ObjectID, ip string, source string, useragent string) *LogsetLogin

func (*LogsetLogin) SetDetail added in v0.1.16

func (x *LogsetLogin) SetDetail(v interface{})

func (*LogsetLogin) SetVersion added in v0.1.16

func (x *LogsetLogin) SetVersion(v string)

type LogsetLoginMetadata added in v0.1.16

type LogsetLoginMetadata struct {
	UserID   primitive.ObjectID `bson:"user_id" json:"-"`
	ClientIP string             `bson:"client_ip" json:"client_ip"`
	Version  string             `bson:"version" json:"version"`
	Source   string             `bson:"source" json:"source" json:"source"`
}

type Picture added in v0.1.0

type Picture struct {
	ID         primitive.ObjectID   `bson:"_id,omitempty" json:"_id"`
	Name       string               `bson:"name" json:"name"`
	Url        string               `bson:"url" json:"url"`
	Query      string               `bson:"query" json:"query"`
	Process    PictureProcess       `bson:"process" json:"process"`
	Categories []primitive.ObjectID `bson:"categories" json:"categories"`
	CreateTime time.Time            `bson:"create_time" json:"create_time"`
	UpdateTime time.Time            `bson:"update_time" json:"update_time"`
}

type PictureProcess added in v0.1.0

type PictureProcess struct {
	Mode int64              `bson:"mode" json:"mode"`
	Cut  PictureProcessCut  `bson:"cut" json:"cut"`
	Zoom PictureProcessZoom `bson:"zoom" json:"zoom"`
}

type PictureProcessCut added in v0.1.0

type PictureProcessCut struct {
	X int64 `bson:"x" json:"x"`
	Y int64 `bson:"y" json:"y"`
	W int64 `bson:"w" json:"w"`
	H int64 `bson:"h" json:"h"`
}

type PictureProcessZoom added in v0.1.0

type PictureProcessZoom struct {
	W int64 `bson:"w" json:"w"`
	H int64 `bson:"h" json:"h"`
}

type Project added in v0.0.29

type Project struct {
	ID         primitive.ObjectID  `bson:"_id,omitempty" json:"_id"`
	Name       string              `bson:"name" json:"name" faker:"first_name"`
	Namespace  string              `bson:"namespace" json:"namespace" faker:"username,unique"`
	Kind       string              `bson:"kind" json:"kind"`
	Expire     *time.Time          `bson:"expire" json:"expire" farker:"-"`
	SecretId   string              `bson:"secret_id" json:"secret_id" faker:"unique"`
	SecretKey  string              `bson:"secret_key" json:"secret_key"`
	Entry      []string            `bson:"entry" json:"entry" farker:"-"`
	Status     bool                `bson:"status" json:"status"`
	Cluster    *primitive.ObjectID `bson:"cluster" json:"cluster"`
	Nats       *ProjectNats        `bson:"nats" json:"nats"`
	Redis      *ProjectRedis       `bson:"redis" json:"redis"`
	CreateTime time.Time           `bson:"create_time" json:"create_time" farker:"-"`
	UpdateTime time.Time           `bson:"update_time" json:"update_time" farker:"-"`
}

func NewProject added in v0.0.29

func NewProject(name string, namespace string) *Project

type ProjectNats added in v0.2.1

type ProjectNats struct {
	Seed string `bson:"seed" json:"seed"`
	Pub  string `bson:"pub" json:"pub"`
}

type ProjectRedis added in v0.2.1

type ProjectRedis struct {
	Url  string `bson:"url" json:"url"`
	Auth string `bson:"auth" json:"auth"`
}

type Queue added in v0.1.0

type Queue struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Project     primitive.ObjectID `bson:"project" json:"project"`
	Name        string             `bson:"name" json:"name"`
	Description string             `bson:"description" json:"description"`
	Subjects    []string           `bson:"subjects" json:"subjects"`
	MaxMsgs     int64              `bson:"max_msgs" json:"max_msgs"`
	MaxBytes    int64              `bson:"max_bytes" json:"max_bytes"`
	MaxAge      time.Duration      `bson:"max_age" json:"max_age"`
	CreateTime  time.Time          `bson:"create_time" json:"create_time" farker:"-"`
	UpdateTime  time.Time          `bson:"update_time" json:"update_time" farker:"-"`
}

type RuleCondition added in v0.2.5

type RuleCondition struct {
	Key   string      `bson:"key" json:"key"`
	Op    string      `bson:"op" json:"op"`
	Value interface{} `bson:"value" json:"value"`
}

type User

type User struct {
	ID         primitive.ObjectID   `bson:"_id,omitempty" json:"_id"`
	Email      string               `bson:"email" json:"email"`
	Password   string               `bson:"password" json:"-"`
	Roles      []primitive.ObjectID `bson:"roles" json:"-"`
	Name       string               `bson:"name" json:"name"`
	Avatar     string               `bson:"avatar" json:"avatar"`
	Phone      string               `bson:"phone,omitempty" json:"-"`
	Totp       string               `bson:"totp,omitempty" json:"-"`
	Lark       *UserLark            `bson:"lark,omitempty" json:"lark"`
	Sessions   int64                `bson:"sessions,omitempty" json:"sessions"`
	History    *LogsetLogin         `bson:"history,omitempty" json:"history"`
	Status     bool                 `bson:"status" json:"status"`
	CreateTime time.Time            `bson:"create_time" json:"create_time"`
	UpdateTime time.Time            `bson:"update_time" json:"update_time"`
}

func NewUser

func NewUser(email string, password string) *User

type UserLark added in v0.1.0

type UserLark struct {
	AccessToken      string `bson:"access_token" json:"access_token"`
	TokenType        string `bson:"token_type" json:"token_type"`
	ExpiresIn        uint64 `bson:"expires_in" json:"expires_in"`
	Name             string `bson:"name" json:"name"`
	EnName           string `bson:"en_name" json:"en_name"`
	AvatarUrl        string `bson:"avatar_url" json:"avatar_url"`
	AvatarThumb      string `bson:"avatar_thumb" json:"avatar_thumb"`
	AvatarMiddle     string `bson:"avatar_middle" json:"avatar_middle"`
	AvatarBig        string `bson:"avatar_big" json:"avatar_big"`
	OpenId           string `bson:"open_id" json:"open_id"`
	UnionId          string `bson:"union_id" json:"union_id"`
	Email            string `bson:"email" json:"email"`
	EnterpriseEmail  string `bson:"enterprise_email" json:"enterprise_email"`
	UserId           string `bson:"user_id" json:"user_id"`
	Mobile           string `bson:"mobile" json:"mobile"`
	TenantKey        string `bson:"tenant_key" json:"tenant_key"`
	RefreshExpiresIn uint64 `bson:"refresh_expires_in" json:"refresh_expires_in"`
	RefreshToken     string `bson:"refresh_token" json:"refresh_token"`
	Sid              string `bson:"sid" json:"sid"`
}

type Video added in v0.1.0

type Video struct {
	ID         primitive.ObjectID   `bson:"_id,omitempty" json:"_id"`
	Name       string               `bson:"name" json:"name"`
	Url        string               `bson:"url" json:"url"`
	Categories []primitive.ObjectID `bson:"categories" json:"categories"`
	CreateTime time.Time            `bson:"create_time" json:"create_time"`
	UpdateTime time.Time            `bson:"update_time" json:"update_time"`
}

type Workflow added in v0.1.0

type Workflow struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Project    primitive.ObjectID `bson:"project" json:"project"`
	Kind       string             `bson:"kind" json:"kind"`
	Name       string             `bson:"name" json:"name"`
	Schedule   *WorkflowSchedule  `bson:"schedule" json:"schedule"`
	CreateTime time.Time          `bson:"create_time" json:"create_time"`
	UpdateTime time.Time          `bson:"update_time" json:"update_time"`
}

type WorkflowSchedule added in v0.1.0

type WorkflowSchedule struct {
	Ref    *primitive.ObjectID   `bson:"ref" json:"ref"`
	Status bool                  `bson:"status" json:"status"`
	Jobs   []WorkflowScheduleJob `bson:"jobs" json:"jobs"`
}

type WorkflowScheduleJob added in v0.1.0

type WorkflowScheduleJob struct {
	Mode   string `bson:"mode" json:"mode"`
	Spec   string `bson:"spec" json:"spec"`
	Option bson.M `bson:"option" json:"option"`
}

Jump to

Keyboard shortcuts

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