db

package
v1.0.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

func NewDb

func NewDb(dsn string) (db *gorm.DB, err error)

Types

type Application

type Application struct {
	gorm.Model
	Name           string `validate:"required"`
	Description    string
	Secret         string
	LatestVersion  string
	LatestCommit   string
	LastDeployedAt time.Time
	Tasks          []Task `validate:"required"`
}

type HttpTask

type HttpTask struct {
	gorm.Model
	TaskId  uint
	Method  string `validate:"required"`
	Url     string `validate:"required,url"`
	Headers datatypes.JSONMap
	Body    string
}

type SshTask

type SshTask struct {
	gorm.Model
	TaskId            uint
	ServerFingerprint string `validate:"required,fingerprint"`
	Username          string `validate:"required"`
	Host              string `validate:"required"`
	Port              uint   `validate:"required,gte=1,lte=65535"`
	Command           string `validate:"required"`
}

type Task

type Task struct {
	gorm.Model
	ApplicationId uint
	Priority      uint
	TaskType      TaskType
	SshTask       *SshTask
	HttpTask      *HttpTask
}

type TaskType

type TaskType int
const (
	TaskTypeSsh TaskType = iota
	TaskTypeHttp
)

func (TaskType) EnumIndex

func (t TaskType) EnumIndex() int

func (TaskType) String

func (t TaskType) String() string

type User

type User struct {
	gorm.Model
	Username    string `gorm:"uniqueIndex"`
	HashedToken string
	LastUsedAt  *time.Time
	Role        string
}

Jump to

Keyboard shortcuts

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