entity

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(entity EntityValidator) error

Types

type DataLog

type DataLog struct {
	Id        int    `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
	TaskId    int    `json:"task_id" form:"task_id" gorm:"type:int(11);not null"`
	CreatedAt int64  `json:"created_at" form:"created_at" gorm:"type:int(11);not null"`
	Level     string `json:"level" form:"level" gorm:"type:varchar(255);not null"`
	Message   string `json:"message" form:"message" gorm:"type:text;not null"`
}

func (DataLog) TableName

func (DataLog) TableName() string

type EntityValidator

type EntityValidator interface {
	Validate() error
}

type Task

type Task struct {
	gorm.Model
	Name        string `json:"name" form:"name" gorm:"type:varchar(255);not null;uniqueIndex" validate:"required"`
	Description string `json:"description" form:"description" gorm:"type:text"`
	Type        string `json:"type" form:"type" gorm:"type:varchar(255);not null" validate:"required,oneof=http https ping port"`
	Target      string `json:"target" form:"target" gorm:"type:longtext;not null" validate:"required"`
	HttpHost    string `json:"http_host" form:"http_host" gorm:"type:varchar(255)"`
	SslVerify   bool   `json:"ssl_verify" form:"ssl_verify" gorm:"type:tinyint(1);not null;default:0"`
	SslExpire   bool   `json:"ssl_expire" form:"ssl_expire" gorm:"type:tinyint(1);not null;default:0"`
	Interval    int64  `json:"interval" form:"interval" gorm:"type:int(11);not null;default:60" validate:"required,gte=0"`
	Timeout     int64  `json:"timeout" form:"timeout" gorm:"type:int(11);not null;default:10000" validate:"required,gte=0"`
	Status      string `json:"status" form:"status" gorm:"type:varchar(255);not null;default:'active'"`
}

func (Task) TableName

func (Task) TableName() string

func (*Task) Validate

func (e *Task) Validate() error

Jump to

Keyboard shortcuts

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