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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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