Documentation ¶
Index ¶
- Constants
- Variables
- func DumpDatabase(filePath string) error
- func InitDBConfig(config *DbCfg)
- func ModelCreate(engine Engine, model ModelProtocol) error
- func ModelGet(id uint64, model ModelProtocol) (bool, error)
- func ModelUpdate(engine Engine, id uint64, model ModelProtocol, specFields ...string) error
- func NewEngine() (err error)
- func NewMailerUser(u *User, activeCodeLives int) mailer.User
- func NewTestEngine(x *xorm.Engine) (err error)
- func Ping() error
- func QueryUsers(currentUserID uint64, pageIndex, pageCount int, email string) (*dto.Pager, error)
- func SetEngine() (err error)
- func Transaction(action func(sess *xorm.Session) (interface{}, error)) (interface{}, error)
- type App
- func (self *App) Collaborators() ([]*Collaborator, error)
- func (self *App) Create(engine Engine) error
- func (self *App) Delete(engine Engine) error
- func (self *App) Deployments() ([]*Deployment, error)
- func (self *App) Exist() (bool, error)
- func (self *App) Get() (bool, error)
- func (self *App) Update(engine Engine, specFields ...string) error
- type Collaborator
- func (self *Collaborator) App() (*App, error)
- func (self *Collaborator) Create(engine Engine) error
- func (self *Collaborator) Delete(engine Engine) error
- func (self *Collaborator) DeleteByAppID(engine Engine) error
- func (self *Collaborator) DeleteByAppIDAndUID(engine Engine) error
- func (self *Collaborator) Exist() (bool, error)
- func (self *Collaborator) Get() (bool, error)
- func (self *Collaborator) Update(engine Engine, specFields ...string) error
- type DbCfg
- type Deployment
- func (self *Deployment) Create(engine Engine) error
- func (self *Deployment) Delete(engine Engine) error
- func (self *Deployment) DeleteAllHistory(engine Engine) error
- func (self *Deployment) DeleteAllPackage(engine Engine) error
- func (self *Deployment) DeleteAllVersion(engine Engine) error
- func (self *Deployment) DeleteByAppID(engine Engine) error
- func (self *Deployment) Detail() (*DeploymentDetail, error)
- func (self *Deployment) Exist() (bool, error)
- func (self *Deployment) Get() (bool, error)
- func (self *Deployment) GetPackageMetricsByAppIDAndName() ([]*PackageMetricsDetail, error)
- func (self *Deployment) Histories() ([]*DeploymentHistoryDetail, error)
- func (self *Deployment) PackageMetricsOfLabel(label string) (*PackageMetrics, error)
- func (self *Deployment) PackageOfVersion(appVersion string) (*Package, error)
- func (self *Deployment) Update(engine Engine, specFields ...string) error
- type DeploymentDetail
- type DeploymentHistory
- func (self *DeploymentHistory) Create(engine Engine) error
- func (self *DeploymentHistory) Delete(engine Engine) error
- func (self *DeploymentHistory) Exist() (bool, error)
- func (self *DeploymentHistory) Get() (bool, error)
- func (self *DeploymentHistory) Update(engine Engine, specFields ...string) error
- type DeploymentHistoryDetail
- type DeploymentVersion
- func (self *DeploymentVersion) Create(engine Engine) error
- func (self *DeploymentVersion) Delete(engine Engine) error
- func (self *DeploymentVersion) Exist() (bool, error)
- func (self *DeploymentVersion) Get() (bool, error)
- func (self *DeploymentVersion) Update(engine Engine, specFields ...string) error
- type Engine
- type JsonObjectConverter
- type ModelProtocol
- type Package
- func (self *Package) Create(engine Engine) error
- func (self *Package) Delete(engine Engine) error
- func (self *Package) Exist() (bool, error)
- func (self *Package) FindPackagesByVersionIDAndReleaseMethods(number int, isAsc bool, methods ...string) ([]*Package, error)
- func (self *Package) FindPrePackages(number int, isAsc bool) ([]*Package, error)
- func (self *Package) Get() (bool, error)
- func (self *Package) Update(engine Engine, specFields ...string) error
- type PackageDetail
- type PackageDiff
- type PackageMetrics
- type PackageMetricsDetail
- type User
- func (self *User) Apps() ([]*App, error)
- func (self *User) Collaborators() ([]*Collaborator, error)
- func (self *User) Convert() interface{}
- func (self *User) Create(engine Engine) error
- func (self *User) Delete(engine Engine) error
- func (self *User) EmailUsable() (bool, error)
- func (self *User) EncodePasswd()
- func (self *User) Exist() (bool, error)
- func (self *User) GenerateRands()
- func (self *User) GenerateSalt()
- func (self *User) Get() (bool, error)
- func (self *User) Tokens() ([]*UserToken, error)
- func (self *User) Update(engine Engine, specFields ...string) error
- func (self *User) ValidatePassword(passwd string) bool
- type UserToken
- func (self *UserToken) Convert() interface{}
- func (self *UserToken) Create(engine Engine) error
- func (self *UserToken) Delete(engine Engine) error
- func (self *UserToken) DeleteByCreatorAndUID(engine Engine) error
- func (self *UserToken) DeleteByNameAndUID(engine Engine) error
- func (self *UserToken) Exist() (bool, error)
- func (self *UserToken) Get() (bool, error)
- func (self *UserToken) GetUnexpired() (bool, error)
- func (self *UserToken) Update(engine Engine, specFields ...string) error
Constants ¶
View Source
const ( USER_STATUS_UN_ACTIVE = iota USER_STATUS_NORMAL USER_STATUS_FORBIDDEN )
Variables ¶
View Source
var ( ErrDataNotExist = errors.New("Data does not exist") ErrDataAlreadyExist = errors.New("Data already exist") )
View Source
var ( HasEngine bool EnableSQLite3 bool EnableTiDB bool )
Functions ¶
func DumpDatabase ¶
DumpDatabase dumps all data from database to file system.
func InitDBConfig ¶
func InitDBConfig(config *DbCfg)
func ModelCreate ¶
func ModelCreate(engine Engine, model ModelProtocol) error
func ModelUpdate ¶
func ModelUpdate(engine Engine, id uint64, model ModelProtocol, specFields ...string) error
func NewTestEngine ¶
func QueryUsers ¶ added in v0.1.1
Types ¶
type App ¶
type App struct { ID uint64 `xorm:"pk autoincr"` Name string `xorm:"unique index notnull"` UID uint64 `xorm:"notnull default(0)"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func FindAppsByIDs ¶
func (*App) Collaborators ¶
func (self *App) Collaborators() ([]*Collaborator, error)
func (*App) Deployments ¶
func (self *App) Deployments() ([]*Deployment, error)
type Collaborator ¶
type Collaborator struct { ID uint64 `xorm:"pk autoincr"` Role int8 `xorm:"notnull default(0)"` UID uint64 `xorm:"index notnull default(0)"` AppID uint64 `xorm:"index notnull default(0)"` Email string `xorm:"index notnull"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func FindCollaboratorByAppNameAndUID ¶
func FindCollaboratorByAppNameAndUID(appName string, uid uint64) (*Collaborator, error)
func FindCollaboratorsByAppIDs ¶
func FindCollaboratorsByAppIDs(appIds []uint64) ([]*Collaborator, error)
func FindOwnerByAppName ¶
func FindOwnerByAppName(appName string) (*Collaborator, error)
func (*Collaborator) App ¶
func (self *Collaborator) App() (*App, error)
func (*Collaborator) Create ¶
func (self *Collaborator) Create(engine Engine) error
func (*Collaborator) Delete ¶
func (self *Collaborator) Delete(engine Engine) error
func (*Collaborator) DeleteByAppID ¶
func (self *Collaborator) DeleteByAppID(engine Engine) error
func (*Collaborator) DeleteByAppIDAndUID ¶
func (self *Collaborator) DeleteByAppIDAndUID(engine Engine) error
func (*Collaborator) Exist ¶
func (self *Collaborator) Exist() (bool, error)
func (*Collaborator) Get ¶
func (self *Collaborator) Get() (bool, error)
type Deployment ¶
type Deployment struct { ID uint64 `xorm:"pk autoincr"` Name string `xorm:"notnull default 'Staging'"` AppID uint64 `xorm:"index notnull default(0)"` Key string `xorm:"unique index notnull"` LastVersionID uint64 `xorm:"notnull default(0)"` LabelCursor int `xorm:"notnull default(0)"` Description string CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func FindDeploymentsByAppIDs ¶
func FindDeploymentsByAppIDs(appIds []uint64) ([]*Deployment, error)
func (*Deployment) Create ¶
func (self *Deployment) Create(engine Engine) error
func (*Deployment) Delete ¶
func (self *Deployment) Delete(engine Engine) error
func (*Deployment) DeleteAllHistory ¶
func (self *Deployment) DeleteAllHistory(engine Engine) error
func (*Deployment) DeleteAllPackage ¶
func (self *Deployment) DeleteAllPackage(engine Engine) error
func (*Deployment) DeleteAllVersion ¶
func (self *Deployment) DeleteAllVersion(engine Engine) error
func (*Deployment) DeleteByAppID ¶
func (self *Deployment) DeleteByAppID(engine Engine) error
func (*Deployment) Detail ¶
func (self *Deployment) Detail() (*DeploymentDetail, error)
func (*Deployment) Exist ¶
func (self *Deployment) Exist() (bool, error)
func (*Deployment) Get ¶
func (self *Deployment) Get() (bool, error)
func (*Deployment) GetPackageMetricsByAppIDAndName ¶
func (self *Deployment) GetPackageMetricsByAppIDAndName() ([]*PackageMetricsDetail, error)
func (*Deployment) Histories ¶
func (self *Deployment) Histories() ([]*DeploymentHistoryDetail, error)
func (*Deployment) PackageMetricsOfLabel ¶
func (self *Deployment) PackageMetricsOfLabel(label string) (*PackageMetrics, error)
func (*Deployment) PackageOfVersion ¶
func (self *Deployment) PackageOfVersion(appVersion string) (*Package, error)
type DeploymentDetail ¶
type DeploymentDetail struct { Deployment `xorm:"extends"` DeploymentVersion `xorm:"extends"` Package `xorm:"extends"` PackageMetrics `xorm:"extends"` }
func FindDeploymentDetailsByAppID ¶
func FindDeploymentDetailsByAppID(appID uint64) ([]*DeploymentDetail, error)
func (*DeploymentDetail) Convert ¶
func (self *DeploymentDetail) Convert() interface{}
type DeploymentHistory ¶
type DeploymentHistory struct { ID uint64 `xorm:"pk autoincr"` DeployID uint64 `xorm:"notnull default(0)"` PackageID uint64 `xorm:"notnull default(0)"` CreatedAt time.Time `xorm:"created"` DeletedAt time.Time `xorm:"deleted"` }
func (*DeploymentHistory) Create ¶
func (self *DeploymentHistory) Create(engine Engine) error
func (*DeploymentHistory) Delete ¶
func (self *DeploymentHistory) Delete(engine Engine) error
func (*DeploymentHistory) Exist ¶
func (self *DeploymentHistory) Exist() (bool, error)
func (*DeploymentHistory) Get ¶
func (self *DeploymentHistory) Get() (bool, error)
type DeploymentHistoryDetail ¶
type DeploymentHistoryDetail struct { DeploymentVersion `xorm:"extends"` Package `xorm:"extends"` PackageMetrics `xorm:"extends"` }
func (*DeploymentHistoryDetail) Convert ¶
func (self *DeploymentHistoryDetail) Convert() interface{}
type DeploymentVersion ¶
type DeploymentVersion struct { ID uint64 `xorm:"pk autoincr"` DeployID uint64 `xorm:"index notnull default(0)"` PackageID uint64 `xorm:"notnull default(0)"` AppVersion string CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func (*DeploymentVersion) Create ¶
func (self *DeploymentVersion) Create(engine Engine) error
func (*DeploymentVersion) Delete ¶
func (self *DeploymentVersion) Delete(engine Engine) error
func (*DeploymentVersion) Exist ¶
func (self *DeploymentVersion) Exist() (bool, error)
func (*DeploymentVersion) Get ¶
func (self *DeploymentVersion) Get() (bool, error)
type Engine ¶
type Engine interface { Delete(interface{}) (int64, error) Exec(string, ...interface{}) (sql.Result, error) Find(interface{}, ...interface{}) error Get(interface{}) (bool, error) Id(interface{}) *xorm.Session In(string, ...interface{}) *xorm.Session Insert(...interface{}) (int64, error) InsertOne(interface{}) (int64, error) Iterate(interface{}, xorm.IterFunc) error Sql(string, ...interface{}) *xorm.Session Table(interface{}) *xorm.Session Where(interface{}, ...interface{}) *xorm.Session }
Engine represents a xorm engine or session.
func EngineGenerate ¶
type JsonObjectConverter ¶
type JsonObjectConverter interface {
Convert() interface{}
}
type ModelProtocol ¶
type Package ¶
type Package struct { ID uint64 `xorm:"pk autoincr"` DeployID uint64 `xorm:"index notnull default(0)"` DeployVersionID uint64 `xorm:"index notnull default(0)"` Description string Hash string BlobURL string Size int64 `xorm:"notnull default(0)"` ManifestBlobURL string ReleaseMethod string Label string `xorm:"index notnull"` OriginalLabel string OriginalDeployment string ReleasedBy string IsMandatory bool `xorm:"notnull default(0)"` IsDisabled bool `xorm:"notnull default(0)"` Rollout uint8 `xorm:"notnull default(100)"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func (*Package) FindPackagesByVersionIDAndReleaseMethods ¶
func (*Package) FindPrePackages ¶
type PackageDetail ¶
type PackageDetail struct { Package `xorm:"extends"` PackageDiff `xorm:"extends"` }
type PackageDiff ¶
type PackageDiff struct { ID uint64 `xorm:"pk autoincr"` OriginalPackageHash string DiffAgainstPackageHash string DiffBlobURL string DiffSize int64 `xorm:"notnull default(0)"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func (*PackageDiff) Create ¶
func (self *PackageDiff) Create(engine Engine) error
func (*PackageDiff) Delete ¶
func (self *PackageDiff) Delete(engine Engine) error
func (*PackageDiff) Exist ¶
func (self *PackageDiff) Exist() (bool, error)
func (*PackageDiff) Get ¶
func (self *PackageDiff) Get() (bool, error)
type PackageMetrics ¶
type PackageMetrics struct { ID uint64 `xorm:"pk autoincr"` PackageID uint64 `xorm:"notnull default(0)"` Active uint64 `xorm:"notnull default(0)"` Downloaded uint64 `xorm:"notnull default(0)"` Failed uint64 `xorm:"notnull default(0)"` Installed uint64 `xorm:"notnull default(0)"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func (*PackageMetrics) Create ¶
func (self *PackageMetrics) Create(engine Engine) error
func (*PackageMetrics) Delete ¶
func (self *PackageMetrics) Delete(engine Engine) error
func (*PackageMetrics) Exist ¶
func (self *PackageMetrics) Exist() (bool, error)
func (*PackageMetrics) Get ¶
func (self *PackageMetrics) Get() (bool, error)
type PackageMetricsDetail ¶
type PackageMetricsDetail struct { *PackageMetrics `xorm:"extends"` Label string }
type User ¶
type User struct { ID uint64 `xorm:"pk autoincr"` Email string `xorm:"unique notnull"` Password string `xorm:"notnull"` Rands string `xorm:"index"` UserName string LowerName string `xorm:"unique notnull"` IsAdmin bool `xorm:"notnull default(0)"` Status int `xorm:"notnull default(0)"` Salt string CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` DeletedAt time.Time `xorm:"deleted"` }
func FindUserByIDs ¶
func (*User) Collaborators ¶
func (self *User) Collaborators() ([]*Collaborator, error)
func (*User) EmailUsable ¶
func (*User) EncodePasswd ¶
func (self *User) EncodePasswd()
func (*User) GenerateRands ¶
func (self *User) GenerateRands()
func (*User) GenerateSalt ¶
func (self *User) GenerateSalt()
func (*User) ValidatePassword ¶
type UserToken ¶
type UserToken struct { ID uint64 `xorm:"pk autoincr"` UID uint64 `xorm:"unique(s) notnull default(0)"` Name string `xorm:"unique(s) notnull"` Token string `xorm:"notnull"` CreatedBy string IsSession bool `xorm:"notnull default(0)"` Description string ExpiresAt time.Time CreatedAt time.Time `xorm:"created"` DeletedAt time.Time `xorm:"deleted"` }
func (*UserToken) DeleteByCreatorAndUID ¶
func (*UserToken) DeleteByNameAndUID ¶
func (*UserToken) GetUnexpired ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.