Documentation ¶
Index ¶
- Variables
- func CountUsers() int64
- func CreateGitxt(g *Gitxt) (err error)
- func CreateUser(u *User) (err error)
- func DeleteExpiredRepositories()
- func DeleteOldRepositoryArchives()
- func DeleteRepository(ownerID int64, repoID int64) error
- func GetUserSalt() (string, error)
- func InitDb()
- func IsErrDeployKeyAlreadyExist(err error) bool
- func IsErrDeployKeyNameAlreadyUsed(err error) bool
- func IsErrDeployKeyNotExist(err error) bool
- func IsErrEmailAlreadyUsed(err error) bool
- func IsErrHashAlreadyExist(err error) bool
- func IsErrKeyAccessDenied(err error) bool
- func IsErrKeyAlreadyExist(err error) bool
- func IsErrKeyNameAlreadyUsed(err error) bool
- func IsErrKeyNotExist(err error) bool
- func IsErrKeyUnableVerify(err error) bool
- func IsErrNamePatternNotAllowed(err error) bool
- func IsErrNameReserved(err error) bool
- func IsErrUserAlreadyExist(err error) bool
- func IsErrUserOwnRepos(err error) bool
- func IsHashUsed(uid int64, hash string) (bool, error)
- func IsUsableUsername(name string) error
- func IsUserExist(uid int64, name string) (bool, error)
- func LoadConfigs()
- func NewEngine() (err error)
- func NewMailerUser(u *User) mailer.User
- func NewTestEngine(x *xorm.Engine) (err error)
- func Ping() error
- func SetEngine() (err error)
- func UpdateCounterGitxts(u int64) error
- func UpdateCounterGitxtsManaged(c int64) error
- func UpdateGitxt(u *Gitxt) error
- func UpdateUser(u *User) error
- func UserPath(userName string) string
- type Counter
- type Engine
- type ErrDeployKeyAlreadyExist
- type ErrDeployKeyNameAlreadyUsed
- type ErrDeployKeyNotExist
- type ErrEmailAlreadyUsed
- type ErrHashAlreadyExist
- type ErrKeyAccessDenied
- type ErrKeyAlreadyExist
- type ErrKeyNameAlreadyUsed
- type ErrKeyNotExist
- type ErrKeyUnableVerify
- type ErrNamePatternNotAllowed
- type ErrNameReserved
- type ErrUserAlreadyExist
- type ErrUserOwnRepos
- type Gitxt
- type GitxtOptions
- type GitxtWithUser
- type SSHKey
- type User
Constants ¶
This section is empty.
Variables ¶
var ( HasEngine bool DbCfg struct { Type, Host, Name, User, Passwd, Path, SSLMode string } EnableSQLite3 bool )
Vars
Functions ¶
func DeleteExpiredRepositories ¶
func DeleteExpiredRepositories()
DeleteExpiredRepositories Delete expired
func DeleteOldRepositoryArchives ¶
func DeleteOldRepositoryArchives()
DeleteOldRepositoryArchives Archive deletion
func DeleteRepository ¶
DeleteRepository Delete repository :'(
func IsErrDeployKeyAlreadyExist ¶
IsErrDeployKeyAlreadyExist func
func IsErrDeployKeyNameAlreadyUsed ¶
IsErrDeployKeyNameAlreadyUsed func
func IsErrDeployKeyNotExist ¶
IsErrDeployKeyNotExist func
func IsErrKeyNameAlreadyUsed ¶
IsErrKeyNameAlreadyUsed func
func IsErrNamePatternNotAllowed ¶
IsErrNamePatternNotAllowed func
func IsHashUsed ¶
IsHashUsed checks if given hash exist,
func IsUserExist ¶
IsUserExist checks if given user name exist, the user name should be noncased unique. If uid is presented, then check will rule out that one, it is used when update a user name in settings page.
func UpdateCounterGitxtsManaged ¶
UpdateCounterGitxtsManaged with count
Types ¶
type Counter ¶
type Counter struct { ID int64 `xorm:"pk autoincr"` Name string `xorm:"UNIQUE NOT NULL"` Count int64 }
Counter struct
func GetCounterGitxtsManaged ¶
GetCounterGitxtsManaged get it
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.
type ErrDeployKeyAlreadyExist ¶
ErrDeployKeyAlreadyExist struct
func (ErrDeployKeyAlreadyExist) Error ¶
func (err ErrDeployKeyAlreadyExist) Error() string
Error func
type ErrDeployKeyNameAlreadyUsed ¶
ErrDeployKeyNameAlreadyUsed struct
func (ErrDeployKeyNameAlreadyUsed) Error ¶
func (err ErrDeployKeyNameAlreadyUsed) Error() string
Error func
type ErrDeployKeyNotExist ¶
ErrDeployKeyNotExist struct
type ErrEmailAlreadyUsed ¶
type ErrEmailAlreadyUsed struct {
Email string
}
ErrEmailAlreadyUsed struct
type ErrHashAlreadyExist ¶
type ErrHashAlreadyExist struct {
Hash string
}
ErrHashAlreadyExist struct
type ErrKeyAccessDenied ¶
ErrKeyAccessDenied struct
type ErrKeyAlreadyExist ¶
ErrKeyAlreadyExist struct
type ErrKeyNameAlreadyUsed ¶
ErrKeyNameAlreadyUsed struct
type ErrKeyUnableVerify ¶
type ErrKeyUnableVerify struct {
Result string
}
ErrKeyUnableVerify struct
type ErrNamePatternNotAllowed ¶
type ErrNamePatternNotAllowed struct {
Pattern string
}
ErrNamePatternNotAllowed struct
func (ErrNamePatternNotAllowed) Error ¶
func (err ErrNamePatternNotAllowed) Error() string
Error func
type ErrUserAlreadyExist ¶
type ErrUserAlreadyExist struct {
Name string
}
ErrUserAlreadyExist struct
type Gitxt ¶
type Gitxt struct { ID int64 `xorm:"pk autoincr"` Hash string `xorm:"UNIQUE NOT NULL"` UserID int64 `xorm:"INDEX"` Anonymous bool Description string `xorm:"TEXT"` // Chosen expiry in hours ExpiryHours int64 `xorm:"INDEX"` // Calculated expiry unix timestamp from the time of creation/update ExpiryUnix int64 Expiry time.Time `xorm:"-"` // Permissions IsPrivate bool `xorm:"DEFAULT 0"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
Gitxt struct
func GetRepositoryByName ¶
GetRepositoryByName returns the repository by given name under user if exists.
type GitxtOptions ¶
GitxtOptions struct
type GitxtWithUser ¶
GitxtWithUser struct
func GetGitxts ¶
func GetGitxts(opts *GitxtOptions) (gitxts []*GitxtWithUser, _ int64, _ error)
GetGitxts Get gitxts
type SSHKey ¶
type SSHKey struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"INDEX NOT NULL"` Name string `xorm:"NOT NULL"` Fingerprint string `xorm:"NOT NULL"` Content string `xorm:"TEXT NOT NULL"` Mode int `xorm:"NOT NULL DEFAULT 2"` Type int `xorm:"NOT NULL DEFAULT 1"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
SSHKey struct
type User ¶
type User struct { ID int64 `xorm:"pk autoincr"` UserName string `xorm:"UNIQUE NOT NULL"` LowerName string `xorm:"UNIQUE NOT NULL"` Email string `xorm:"NOT NULL"` Password string `xorm:"NOT NULL"` Rands string `xorm:"VARCHAR(10)"` Salt string `xorm:"VARCHAR(10)"` // Permissions IsAdmin bool `xorm:"DEFAULT 0"` IsActive bool `xorm:"DEFAULT 0"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
User struct
func GetUserByEmail ¶
GetUserByEmail returns the user object by given e-mail if exists.
func GetUserByID ¶
GetUserByID returns the user object by given ID if exists.
func GetUserByName ¶
GetUserByName returns user by given name.
func VerifyUserActiveCode ¶
VerifyUserActiveCode when active account
func (*User) EncodePasswd ¶
func (user *User) EncodePasswd()
EncodePasswd encodes password to safe format.
func (*User) GenerateActivateCode ¶
GenerateActivateCode generates an activate code based on user information.
func (*User) GenerateEmailActivateCode ¶
GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
func (*User) ValidatePassword ¶
ValidatePassword checks if given password matches the one belongs to the user.