db

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskResultStatusClosed  = "closed"
	TaskResultStatusError   = "error"
	TaskResultStatusMerged  = "merged"
	TaskResultStatusOpen    = "open"
	TaskResultStatusUnknown = "unknown"
)

Variables

This section is empty.

Functions

func Migrate added in v0.18.0

func Migrate(db *sql.DB) error

func New

func New(enableLog, migrate bool, path string) (*gorm.DB, error)

Types

type Run

type Run struct {
	Error           *string
	ID              uint `gorm:"primarykey"`
	FinishedAt      *time.Time
	Reason          RunReason
	RepositoryNames StringList `gorm:"type:text"`
	ScheduleAfter   time.Time
	StartedAt       *time.Time
	Status          RunStatus
	TaskName        string
	RunData         StringMap `gorm:"type:text"`
}

type RunReason

type RunReason uint
const (
	RunReasonManual RunReason = iota
	RunReasonChanged
	RunReasonNew
	RunReasonNext
	RunReasonWebhook
	RunReasonCron
)

type RunStatus

type RunStatus uint
const (
	RunStatusPending RunStatus = iota
	RunStatusRunning
	RunStatusFinished
	RunStatusFailed
)

type StringList added in v0.16.0

type StringList []string

StringList represents a database type that stores a list of strings.

func (*StringList) Scan added in v0.16.0

func (sl *StringList) Scan(value any) error

Scan implements sql.Scanner.

func (StringList) Value added in v0.16.0

func (sl StringList) Value() (driver.Value, error)

Value implements sql.Valuer.

type StringMap added in v0.18.0

type StringMap map[string]string

StringMap represents a field that contains multiple key/value pairs.

func (*StringMap) Scan added in v0.18.0

func (sm *StringMap) Scan(value any) error

Scan implements sql.Scanner.

func (StringMap) String added in v0.18.0

func (sl StringMap) String() string

String serializes the content of the map to a string.

func (StringMap) Value added in v0.18.0

func (sl StringMap) Value() (driver.Value, error)

Value implements sql.Valuer.

type Task

type Task struct {
	Active bool
	ID     uint `gorm:"primarykey"`
	Name   string
	Hash   string
}

type TaskResult

type TaskResult struct {
	CreatedAt      time.Time
	Error          *string
	ID             uint `gorm:"primarykey"`
	PullRequestUrl *string
	RepositoryName string
	Result         int
	Status         TaskResultStatus
	RunID          uint
}

type TaskResultStatus added in v0.18.0

type TaskResultStatus string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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