db

package
v2.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mysql *gorp.DbMap
View Source
var Versions []*DBVersion

Functions

func Connect

func Connect() error

Mysql database

func MigrateAll

func MigrateAll() error
func SetupDBLink()

Types

type APIToken

type APIToken struct {
	ID      string    `db:"id" json:"id"`
	Created time.Time `db:"created" json:"created"`
	Expired bool      `db:"expired" json:"expired"`
	UserID  int       `db:"user_id" json:"user_id"`
}

type AccessKey

type AccessKey struct {
	ID   int    `db:"id" json:"id"`
	Name string `db:"name" json:"name" binding:"required"`
	// 'aws/do/gcloud/ssh',
	Type string `db:"type" json:"type" binding:"required"`

	ProjectID *int    `db:"project_id" json:"project_id"`
	Key       *string `db:"key" json:"key"`
	Secret    *string `db:"secret" json:"secret"`

	Removed bool `db:"removed" json:"removed"`
}

func (AccessKey) GetPath

func (key AccessKey) GetPath() string

type DBVersion

type DBVersion struct {
	Major int
	Minor int
	Patch int
	Build string

	UpgradedDate *time.Time
	Notes        *string
}

func (*DBVersion) CheckExists

func (version *DBVersion) CheckExists() (bool, error)

func (*DBVersion) GetErrPath

func (version *DBVersion) GetErrPath() string

func (*DBVersion) GetPath

func (version *DBVersion) GetPath() string

func (*DBVersion) GetSQL

func (version *DBVersion) GetSQL(path string) []string

func (*DBVersion) HumanoidVersion

func (version *DBVersion) HumanoidVersion() string

func (*DBVersion) Run

func (version *DBVersion) Run() error

func (*DBVersion) TryRollback

func (version *DBVersion) TryRollback()

func (*DBVersion) VersionString

func (version *DBVersion) VersionString() string

type Environment

type Environment struct {
	ID        int     `db:"id" json:"id"`
	Name      string  `db:"name" json:"name" binding:"required"`
	ProjectID int     `db:"project_id" json:"project_id"`
	Password  *string `db:"password" json:"password"`
	JSON      string  `db:"json" json:"json" binding:"required"`
	Removed   bool    `db:"removed" json:"removed"`
}

type Event

type Event struct {
	ProjectID   *int      `db:"project_id" json:"project_id"`
	ObjectID    *int      `db:"object_id" json:"object_id"`
	ObjectType  *string   `db:"object_type" json:"object_type"`
	Description *string   `db:"description" json:"description"`
	Created     time.Time `db:"created" json:"created"`

	ObjectName  string  `db:"-" json:"object_name"`
	ProjectName *string `db:"project_name" json:"project_name"`
}

func (Event) Insert

func (evt Event) Insert() error

type Inventory

type Inventory struct {
	ID        int    `db:"id" json:"id"`
	Name      string `db:"name" json:"name" binding:"required"`
	ProjectID int    `db:"project_id" json:"project_id"`
	Inventory string `db:"inventory" json:"inventory"`

	// accesses dynamic inventory
	KeyID *int      `db:"key_id" json:"key_id"`
	Key   AccessKey `db:"-" json:"-"`
	// accesses hosts in inventory
	SshKeyID *int      `db:"ssh_key_id" json:"ssh_key_id"`
	SshKey   AccessKey `db:"-" json:"-"`

	// static/aws/do/gcloud
	Type string `db:"type" json:"type"`

	Removed bool `db:"removed" json:"removed"`
}

type Project

type Project struct {
	ID        int       `db:"id" json:"id"`
	Name      string    `db:"name" json:"name" binding:"required"`
	Created   time.Time `db:"created" json:"created"`
	Alert     bool      `db:"alert" json:"alert"`
	AlertChat string    `db:"alert_chat" json:"alert_chat"`
}

func (*Project) CreateProject

func (project *Project) CreateProject() error

type Repository

type Repository struct {
	ID        int    `db:"id" json:"id"`
	Name      string `db:"name" json:"name" binding:"required"`
	ProjectID int    `db:"project_id" json:"project_id"`
	GitUrl    string `db:"git_url" json:"git_url" binding:"required"`
	SshKeyID  int    `db:"ssh_key_id" json:"ssh_key_id" binding:"required"`
	Removed   bool   `db:"removed" json:"removed"`

	SshKey AccessKey `db:"-" json:"-"`
}

type Session

type Session struct {
	ID         int       `db:"id" json:"id"`
	UserID     int       `db:"user_id" json:"user_id"`
	Created    time.Time `db:"created" json:"created"`
	LastActive time.Time `db:"last_active" json:"last_active"`
	IP         string    `db:"ip" json:"ip"`
	UserAgent  string    `db:"user_agent" json:"user_agent"`
	Expired    bool      `db:"expired" json:"expired"`
}

type Task

type Task struct {
	ID         int `db:"id" json:"id"`
	TemplateID int `db:"template_id" json:"template_id" binding:"required"`

	Status string `db:"status" json:"status"`
	Debug  bool   `db:"debug" json:"debug"`

	DryRun bool `db:"dry_run" json:"dry_run"`

	// override variables
	Playbook    string `db:"playbook" json:"playbook"`
	Environment string `db:"environment" json:"environment"`

	UserID *int `db:"user_id" json:"user_id"`

	Created time.Time  `db:"created" json:"created"`
	Start   *time.Time `db:"start" json:"start"`
	End     *time.Time `db:"end" json:"end"`
}

type TaskOutput

type TaskOutput struct {
	TaskID int       `db:"task_id" json:"task_id"`
	Task   string    `db:"task" json:"task"`
	Time   time.Time `db:"time" json:"time"`
	Output string    `db:"output" json:"output"`
}

type Template

type Template struct {
	ID int `db:"id" json:"id"`

	SshKeyID      int  `db:"ssh_key_id" json:"ssh_key_id"`
	ProjectID     int  `db:"project_id" json:"project_id"`
	InventoryID   int  `db:"inventory_id" json:"inventory_id"`
	RepositoryID  int  `db:"repository_id" json:"repository_id"`
	EnvironmentID *int `db:"environment_id" json:"environment_id"`

	// Alias as described in https://github.com/ansible-semaphore/semaphore/issues/188
	Alias string `db:"alias" json:"alias"`
	// playbook name in the form of "some_play.yml"
	Playbook string `db:"playbook" json:"playbook"`
	// to fit into []string
	Arguments *string `db:"arguments" json:"arguments"`
	// if true, semaphore will not prepend any arguments to `arguments` like inventory, etc
	OverrideArguments bool `db:"override_args" json:"override_args"`
}

type TemplateSchedule

type TemplateSchedule struct {
	TemplateID int    `db:"template_id" json:"template_id"`
	CronFormat string `db:"cron_format" json:"cron_format"`
}

type User

type User struct {
	ID       int       `db:"id" json:"id"`
	Created  time.Time `db:"created" json:"created"`
	Username string    `db:"username" json:"username" binding:"required"`
	Name     string    `db:"name" json:"name" binding:"required"`
	Email    string    `db:"email" json:"email" binding:"required"`
	Password string    `db:"password" json:"-"`
	External bool      `db:"external" json:"external"`
	Alert    bool      `db:"alert" json:"alert"`
}

func FetchUser

func FetchUser(userID int) (*User, error)

Jump to

Keyboard shortcuts

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