model

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

Types

type Repo

type Repo struct {
	Name string `gorm:"primaryKey" json:"name" validate:"required"`
	// NOTE: the cron validator does not support */number syntax
	Cron        string    `json:"cron" validate:"required"`
	Image       string    `json:"image" validate:"required"`
	StorageDir  string    `json:"storageDir" validate:"required,dir"`
	User        string    `json:"user"`
	BindIP      string    `json:"bindIP" validate:"omitempty,ip"`
	Network     string    `json:"network"`
	LogRotCycle int       `json:"logRotCycle" validate:"min=0"`
	Retry       int       `json:"retry"  validate:"min=0"`
	Envs        StringMap `gorm:"type:text;serializer:json" json:"envs"`
	Volumes     StringMap `gorm:"type:text;serializer:json" json:"volumes"`
	// sqlite3 does not have builtin datetime type
	CreatedAt int64 `gorm:"autoCreateTime" json:"-"`
	UpdatedAt int64 `gorm:"autoUpdateTime" json:"-"`
}

Repo represents a Repository.

type RepoMeta

type RepoMeta struct {
	Name        string `gorm:"primaryKey"`
	Upstream    string
	Size        int64
	ExitCode    int
	CreatedAt   int64 `gorm:"autoCreateTime"`
	UpdatedAt   int64 `gorm:"autoUpdateTime"`
	LastSuccess int64
	PrevRun     int64
	NextRun     int64
	Syncing     bool
}

RepoMeta represents the metadata of a Repository.

type StringMap

type StringMap map[string]string

Jump to

Keyboard shortcuts

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