Documentation
¶
Index ¶
- Constants
- Variables
- func IsDupEntry(err error) bool
- func IsErrAlreadyLocked(err error) bool
- func IsErrExist(err error) bool
- func IsErrNamingRule(err error) bool
- func IsErrRevisionNotFound(err error) bool
- func IsErrorCode(err error, code uint16) bool
- func IsNotFound(err error) bool
- type AccessLevel
- type Branch
- type Command
- type DB
- type ErrAlreadyLocked
- type ErrExist
- type ErrNamingRule
- type ErrRevisionNotFound
- type Key
- type KeyType
- type Member
- type MemberType
- type Namespace
- type Reference
- type Repository
- type Tag
- type User
- type UserType
Constants ¶
View Source
const ( ER_ACCESS_DENIED_ERROR = 1045 ER_DUP_ENTRY = 1062 )
View Source
const ( DefaultBranch = "mainline" DefaultCompressionALGO = "zstd" DefaultHashALGO = "BLAKE3" DeletedSuffix = ".deleted" Dot = "." DotDot = ".." DotZeta = ".zeta" )
View Source
const ( PrivateNamespace = 1 GroupNamespace = 2 )
View Source
const ( PrivateRepository = 0 InternalRepository = 10 PublicRepository = 20 AnonymousRepository = 30 )
Variables ¶
View Source
var ( ErrReferenceNotAllowed = errors.New("reference types not allowed") ErrUserNotGiven = errors.New("user not given") )
Functions ¶
func IsDupEntry ¶
func IsErrAlreadyLocked ¶
func IsErrExist ¶
func IsErrNamingRule ¶
func IsErrRevisionNotFound ¶
func IsErrorCode ¶
func IsNotFound ¶
Types ¶
type AccessLevel ¶
type AccessLevel int
const ( NoneAccess AccessLevel = 0 ReporterAccess AccessLevel = 20 DevAccess AccessLevel = 30 MasterAccess AccessLevel = 40 OwnerAccess AccessLevel = 50 )
func (AccessLevel) Readable ¶
func (accessLevel AccessLevel) Readable() bool
func (AccessLevel) Sudo ¶
func (accessLevel AccessLevel) Sudo() bool
func (AccessLevel) Writeable ¶
func (accessLevel AccessLevel) Writeable() bool
type DB ¶
type DB interface { Database() *sql.DB FindUser(ctx context.Context, uid int64) (*User, error) SearchUser(ctx context.Context, emailOrName string) (*User, error) SearchKey(ctx context.Context, fingerprint string) (*Key, error) NewUser(ctx context.Context, u *User) (*User, error) AddMember(ctx context.Context, m *Member) error FindKey(ctx context.Context, id int64) (*Key, error) AddKey(ctx context.Context, k *Key) (*Key, error) IsDeployKeyEnabled(ctx context.Context, rid int64, kid int64) (bool, error) FindNamespaceByID(ctx context.Context, namespaceID int64) (*Namespace, error) FindNamespaceByPath(ctx context.Context, namespacePath string) (*Namespace, error) FindRepositoryByID(ctx context.Context, rid int) (*Namespace, *Repository, error) FindRepositoryByPath(ctx context.Context, namespacePath, repoPath string) (*Namespace, *Repository, error) NewRepository(ctx context.Context, r *Repository) (*Repository, error) RepoAccessLevel(ctx context.Context, r *Repository, u *User) (AccessLevel, AccessLevel, error) FindBranchForPrefix(ctx context.Context, rid int64, prefix string) (*Branch, error) FindTagForPrefix(ctx context.Context, rid int64, prefix string) (*Tag, error) FindBranch(ctx context.Context, rid int64, branchName string) (*Branch, error) FindTag(ctx context.Context, rid int64, tagName string) (*Tag, error) DoBranchUpdate(ctx context.Context, cmd *Command) (*Branch, error) DoReferenceUpdate(ctx context.Context, cmd *Command) (*Reference, error) Close() error }
type ErrAlreadyLocked ¶
type ErrAlreadyLocked struct {
Reference string
}
func (*ErrAlreadyLocked) Error ¶
func (e *ErrAlreadyLocked) Error() string
type ErrNamingRule ¶
type ErrNamingRule struct {
// contains filtered or unexported fields
}
func (*ErrNamingRule) Error ¶
func (e *ErrNamingRule) Error() string
type ErrRevisionNotFound ¶
type ErrRevisionNotFound struct {
Revision string
}
func (*ErrRevisionNotFound) Error ¶
func (err *ErrRevisionNotFound) Error() string
type Member ¶
type Member struct { ID int64 `json:"id"` UID int64 `json:"uid"` AccessLevel AccessLevel `json:"access_level"` SourceID int64 `json:"source_id"` SourceType MemberType `json:"source_type"` ExpiresAt time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type MemberType ¶
type MemberType int
const ( ProjectMember MemberType = 2 GroupMember MemberType = 3 )
type Repository ¶
type Repository struct { ID int64 `json:"id"` NamespaceID int64 `json:"namespace_id"` Name string `json:"name"` Path string `json:"path"` Description string `json:"description"` VisibleLevel int `json:"visible_level"` // 0-private, 20-public, 30-anonymous DefaultBranch string `json:"default_branch"` HashAlgo string `json:"hash_algo"` CompressionAlgo string `json:"compression_algo"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Repository) IsInternal ¶
func (r *Repository) IsInternal() bool
func (*Repository) IsPublic ¶
func (r *Repository) IsPublic() bool
func (*Repository) Validate ¶
func (r *Repository) Validate() error
type User ¶
type User struct { ID int64 `json:"id"` UserName string `json:"username"` Name string `json:"name"` Administrator bool `json:"administrator"` Email string `json:"email"` Type UserType `json:"type"` LockedAt time.Time `json:"locked_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Password string `json:"-"` SignatureToken string `json:"-"` }
Click to show internal directories.
Click to hide internal directories.