models

package
v1.0.1-0...-cbd2a5d Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VCSGit    = "git"
	VCSSvn    = "svn"
	VCSBzr    = "bzr"
	VCSHg     = "hg"
	VCSFossil = "fossil"
)

Version control system constants.

View Source
const (
	ActionGoGet = "go-get"
)

Variables

Functions

func CountDomainsByUser

func CountDomainsByUser(ctx context.Context, db *sqlx.DB, count *int64, userID string) error

func CountPackagesByDomainID

func CountPackagesByDomainID(ctx context.Context, db *sqlx.DB, count *int64, domainID int64) error

func CountPackagesByUser

func CountPackagesByUser(ctx context.Context, db *sqlx.DB, count *int64, userID string) error

func FindDomainByChallengeTXT

func FindDomainByChallengeTXT(ctx context.Context, db *sqlx.DB, dest interface{}, name, txt string) error

func FindDomainByUser

func FindDomainByUser(ctx context.Context, db *sqlx.DB, dest interface{}, id int64, userID string) error

func FindDomainsByUser

func FindDomainsByUser(ctx context.Context, db *sqlx.DB, dest interface{}, userID string) error

func FindPackageByDomainAndPath

func FindPackageByDomainAndPath(ctx context.Context, db *sqlx.DB, pkg interface{}, domain, path string) error

func FindPackageByUser

func FindPackageByUser(ctx context.Context, db *sqlx.DB, pkg interface{}, id int64, userID string) error

Types

type Action

type Action struct {
	ID        string    `db:"id" json:"id"`
	Kind      string    `db:"kind" json:"kind"`
	PackageID int64     `db:"package_id" json:"package_id"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
}

func NewAction

func NewAction(kind string, packageID int64) *Action

func (*Action) Save

func (act *Action) Save(ctx context.Context, db *sqlx.DB) error

type Calendar

type Calendar struct {
	ID time.Time `db:"id" json:"id"`
}

type Domain

type Domain struct {
	Model
	UserID       string `json:"user_id" db:"user_id"`
	Name         string `json:"name" db:"name"`
	Verified     bool   `json:"verified" db:"verified"`
	ChallengeTXT string `json:"-" db:"challenge_txt"`
}

func NewDomain

func NewDomain(name, userID string) *Domain

func (*Domain) Challenge

func (d *Domain) Challenge(ctx context.Context, db *sqlx.DB) error

func (*Domain) Delete

func (d *Domain) Delete(ctx context.Context, db *sqlx.DB) error

func (*Domain) Insert

func (d *Domain) Insert(ctx context.Context, db *sqlx.DB) error

func (*Domain) Update

func (d *Domain) Update(ctx context.Context, db *sqlx.DB) error

func (Domain) Validate

func (d Domain) Validate() error

type Model

type Model struct {
	ID        int64     `db:"id" json:"id"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type Package

type Package struct {
	Model
	DomainID int64  `db:"domain_id" json:"domain_id" schema:"domain_id"`
	Path     string `db:"path" json:"path" schema:"path"`
	VCS      string `db:"vcs" json:"vcs" schema:"vcs"`
	Root     string `db:"root" json:"root" schema:"root"`
	Docs     string `db:"docs" json:"docs" schema:"docs"`

	Domain Domain `db:"domain,prefix=domain."`
}

Package is a model that mapping to table "packages".

func NewPackage

func NewPackage(domainID int64, path, vcs, root string) *Package

func (Package) Delete

func (pkg Package) Delete(ctx context.Context, db *sqlx.DB) error

func (Package) DocsURL

func (pkg Package) DocsURL() string

DocsURL returns the URL of docs.

func (Package) ImportMeta

func (pkg Package) ImportMeta() string

ImportMeta returns go-import meta value.

func (*Package) Insert

func (pkg *Package) Insert(ctx context.Context, db *sqlx.DB) error

Insert saves package into database.

func (Package) Prefix

func (pkg Package) Prefix() string

Prefix returns the prefix of package.

func (*Package) Update

func (pkg *Package) Update(ctx context.Context, db *sqlx.DB) error

Jump to

Keyboard shortcuts

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