Documentation ¶
Index ¶
- Constants
- func ApplyMigrations(db *gorm.DB) error
- func Close() error
- func CountAll(table interface{}) (int64, error)
- func CountAllGistsForkedByUser(fromUserId uint, currentUserId uint) (int64, error)
- func CountAllGistsFromUser(fromUserId uint, currentUserId uint) (int64, error)
- func CountAllGistsLikedByUser(fromUserId uint, currentUserId uint) (int64, error)
- func GetSetting(key string) (string, error)
- func GetSettings() (map[string]string, error)
- func GetUsersFromEmails(emailsSet map[string]struct{}) (map[string]*User, error)
- func IsUniqueConstraintViolation(err error) bool
- func SSHKeyLastUsedNow(sshKeyContent string) error
- func Setup(dbPath string, sharedCache bool) error
- func UpdateSetting(key string, value string) error
- func UserExists(username string) (bool, error)
- type AdminSetting
- type FileDTO
- type Gist
- func GetAllGists(offset int) ([]*Gist, error)
- func GetAllGistsForCurrentUser(currentUserId uint, offset int, sort string, order string) ([]*Gist, error)
- func GetAllGistsForkedByUser(fromUserId uint, currentUserId uint, offset int, sort string, order string) ([]*Gist, error)
- func GetAllGistsFromSearch(currentUserId uint, query string, offset int, sort string, order string) ([]*Gist, error)
- func GetAllGistsFromUser(fromUserId uint, currentUserId uint, offset int, sort string, order string) ([]*Gist, error)
- func GetAllGistsLikedByUser(fromUserId uint, currentUserId uint, offset int, sort string, order string) ([]*Gist, error)
- func GetAllGistsRows() ([]*Gist, error)
- func GetGist(user string, gistUuid string) (*Gist, error)
- func GetGistByID(gistId string) (*Gist, error)
- func (gist *Gist) AddAndCommitFiles(files *[]FileDTO) error
- func (gist *Gist) AppendUserLike(user *User) error
- func (gist *Gist) BeforeDelete(tx *gorm.DB) error
- func (gist *Gist) CanWrite(user *User) bool
- func (gist *Gist) Create() error
- func (gist *Gist) CreateForked() error
- func (gist *Gist) Delete() error
- func (gist *Gist) DeleteRepository() error
- func (gist *Gist) File(revision string, filename string, truncate bool) (*git.File, error)
- func (gist *Gist) Files(revision string) ([]*git.File, error)
- func (gist *Gist) ForkClone(username string, uuid string) error
- func (gist *Gist) GetForkParent(user *User) (*Gist, error)
- func (gist *Gist) GetForks(currentUserId uint, offset int) ([]*Gist, error)
- func (gist *Gist) GetUsersLikes(offset int) ([]*User, error)
- func (gist *Gist) IncrementForkCount() error
- func (gist *Gist) InitRepository() error
- func (gist *Gist) InitRepositoryViaInit(ctx echo.Context) error
- func (gist *Gist) Log(skip int) ([]*git.Commit, error)
- func (gist *Gist) NbCommits() (string, error)
- func (gist *Gist) RPC(service string) ([]byte, error)
- func (gist *Gist) RemoveUserLike(user *User) error
- func (gist *Gist) SetLastActiveNow() error
- func (gist *Gist) Update() error
- func (gist *Gist) UpdatePreviewAndCount() error
- func (gist *Gist) UpdateServerInfo() error
- type GistDTO
- type Like
- type MigrationVersion
- type SSHKey
- type SSHKeyDTO
- type User
- type UserDTO
Constants ¶
View Source
const ( SettingDisableSignup = "disable-signup" SettingRequireLogin = "require-login" SettingDisableLoginForm = "disable-login-form" SettingDisableGravatar = "disable-gravatar" )
Variables ¶
This section is empty.
Functions ¶
func ApplyMigrations ¶
func CountAllGistsFromUser ¶
func GetSetting ¶
func GetSettings ¶
func GetUsersFromEmails ¶
func SSHKeyLastUsedNow ¶
func UpdateSetting ¶
func UserExists ¶
Types ¶
type AdminSetting ¶
type Gist ¶
type Gist struct { ID uint `gorm:"primaryKey"` Uuid string Title string Preview string PreviewFilename string Description string Private int // 0: public, 1: unlisted, 2: private UserID uint User User NbFiles int NbLikes int NbForks int CreatedAt int64 UpdatedAt int64 Likes []User `gorm:"many2many:likes;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Forked *Gist `gorm:"foreignKey:ForkedID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"` ForkedID uint }
func GetAllGists ¶
func GetAllGistsForkedByUser ¶
func GetAllGistsFromSearch ¶
func GetAllGistsFromUser ¶
func GetAllGistsLikedByUser ¶
func GetAllGistsRows ¶
func GetGistByID ¶
func (*Gist) AddAndCommitFiles ¶
func (*Gist) AppendUserLike ¶
func (*Gist) CreateForked ¶
func (*Gist) DeleteRepository ¶
func (*Gist) IncrementForkCount ¶
func (*Gist) InitRepository ¶
func (*Gist) InitRepositoryViaInit ¶
func (*Gist) RemoveUserLike ¶
func (*Gist) SetLastActiveNow ¶
func (*Gist) UpdatePreviewAndCount ¶
func (*Gist) UpdateServerInfo ¶
type GistDTO ¶
type GistDTO struct { Title string `validate:"max=250" form:"title"` Description string `validate:"max=1000" form:"description"` Private int `validate:"number,min=0,max=2" form:"private"` Files []FileDTO `validate:"min=1,dive"` Name []string `form:"name"` Content []string `form:"content"` }
func (*GistDTO) ToExistingGist ¶
type MigrationVersion ¶
type SSHKey ¶
type SSHKey struct { ID uint `gorm:"primaryKey"` Title string Content string SHA string CreatedAt int64 LastUsedAt int64 UserID uint User User `validate:"-" ` }
func GetSSHKeyByID ¶
func GetSSHKeysByUserID ¶
func SSHKeyDoesExists ¶
type SSHKeyDTO ¶
type User ¶
type User struct { ID uint `gorm:"primaryKey"` Username string `gorm:"uniqueIndex"` Password string IsAdmin bool CreatedAt int64 Email string MD5Hash string // for gravatar, if no Email is specified, the value is random AvatarURL string GithubID string GiteaID string OIDCID string `gorm:"column:oidc_id"` Gists []Gist `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:UserID"` SSHKeys []SSHKey `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:UserID"` Liked []Gist `gorm:"many2many:likes;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
func GetAllUsers ¶
func GetUserById ¶
func GetUserByUsername ¶
func (*User) DeleteProviderID ¶
Click to show internal directories.
Click to hide internal directories.