db

package
v0.0.0-...-c5e44dc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SESSION *gorm.DB

Functions

func AddProject

func AddProject(name string, ptype ProjectType, repoOwner, repoName, branch, gho string, deployment []byte, envVars []ProjectEnvVar) error

func AddUser

func AddUser(gho string) error

func Load

func Load() error

func UpdateUser

func UpdateUser(user *User) error

Types

type Project

type Project struct {
	Id         uint            `gorm:"primary_key;autoIncrement:true" json:"id"`
	EnvVars    []ProjectEnvVar `gorm:"foreignKey:ProjectId" json:"env"`
	Name       string          `json:"name"`
	Type       ProjectType     `json:"type"`
	RepoOwner  string          `json:"repo_owner"`
	RepoName   string          `json:"repo_name"`
	Branch     string          `json:"branch"`
	Gho        string          `json:"-"`
	Deployment []byte          `json:"-"`
}

func GetProject

func GetProject(id uint) (*Project, error)

func GetProjectByName

func GetProjectByName(repoOwner, repoName string) (*Project, error)

func ListProjects

func ListProjects() ([]Project, error)

type ProjectEnvVar

type ProjectEnvVar struct {
	ProjectId uint   `gorm:"primary_key" json:"-"`
	Key       string `gorm:"primary_key" json:"key"`
	Value     string `json:"value"`
}

type ProjectType

type ProjectType int
const (
	ProjectTypeDockerfile ProjectType
	ProjectTypeCompose
	ProjectTypeShell
	ProjectTypeCommand
)

type User

type User struct {
	Id       uint `gorm:"primary_key;autoIncrement:true" json:"id"`
	Name     string
	Username string
	GhOToken string `json:"gho"`
}

func GetuserById

func GetuserById(userid uint) *User

Jump to

Keyboard shortcuts

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