models

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProject

func AddProject(data map[string]interface{}) error

AddProject add a single article

func CheckAuth

func CheckAuth(username, password string) (bool, error)

CheckAuth checks if authentication information exists

func CloseDB

func CloseDB()

CloseDB closes database connection (unnecessary)

func CreateRunner

func CreateRunner(r *Runner, service Service) error

func CreateUser added in v0.2.1

func CreateUser(db *gorm.DB) error

func DeleteProject

func DeleteProject(id uint) error

Deleteproject delete a single article

func DestroyTestDB

func DestroyTestDB(name string)

func EditProject

func EditProject(id uint, data interface{}) error

EditProject modify a single article

func ExistProjectByID

func ExistProjectByID(id uint) (bool, error)

ExistProjectByID checks if an project exists based on ID

func GetAllServicesForProject

func GetAllServicesForProject(services *[]Service, projectId uint) error

func GetRunner

func GetRunner(runner *Runner, service Service) error

func GetService

func GetService(service *Service, projectId, serviceId uint) error

func InitTestDB

func InitTestDB(name string) *gorm.DB

func Setup

func Setup(repository *Repository) *gorm.DB

Setup initializes the database instance

Types

type Auth

type Auth struct {
	ID       int    `gorm:"primary_key" json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type ExecutableStoreDb

type ExecutableStoreDb struct {
}

func (ExecutableStoreDb) Add

func (s ExecutableStoreDb) Add(p string, b []byte) (err error)

func (ExecutableStoreDb) Exists

func (s ExecutableStoreDb) Exists(p string) (bool, error)

func (ExecutableStoreDb) GetPath

func (s ExecutableStoreDb) GetPath(p string) string

func (ExecutableStoreDb) Load

func (s ExecutableStoreDb) Load(p string) ([]byte, error)

type ExecutableStoreDbItem

type ExecutableStoreDbItem struct {
	ModelNonId

	Path       string `gorm:"primary_key" json:"Path"`
	Executable []byte
}

func NewExecutableStoreDbItem

func NewExecutableStoreDbItem(p string) ExecutableStoreDbItem

type GitRepository

type GitRepository struct {
	Model

	Url       string `gorm:"column:url"`
	ProjectID uint
}

func (GitRepository) TableName

func (GitRepository) TableName() string

type Model

type Model struct {
	ModelNonId

	ID uint `gorm:"primary_key" json:"id"`
}

type ModelNonId

type ModelNonId struct {
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type Project

type Project struct {
	Model

	Name        string `json:"name"`
	Description string `json:"description"`
	CreatedBy   string `json:"created_by"`
	ModifiedBy  string `json:"modified_by"`
	State       int    `json:"state"`

	GitRepository *GitRepository
	Services      []Service
}

func GetProject

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

GetProject Get a single project based on ID

func GetProjects

func GetProjects() ([]*Project, error)

GetProjects gets a list of projects based on paging constraints

func (*Project) Update

func (project *Project) Update() error

Update a single project

type Repository

type Repository struct {
	Db *gorm.DB
}
var Repo *Repository

type Runner

type Runner struct {
	Model

	//Size     string
	Endpoint string `json:"endpoint"`
	Pid      int

	ServiceID uint
}

type Service

type Service struct {
	Model
	Name string

	ProjectID uint
	Runners   []Runner
}

func NewServiceForProject

func NewServiceForProject(p *Project, n string) (*Service, error)

Jump to

Keyboard shortcuts

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