Documentation ¶
Index ¶
- Constants
- func ApplyMigrations(db *gorm.DB) 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) 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) 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 CountAllGistsForkedByUser ¶ added in v1.4.0
func CountAllGistsFromUser ¶ added in v1.4.0
func CountAllGistsLikedByUser ¶ added in v1.4.0
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 bool 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 ¶ added in v1.4.0
func GetAllGistsFromSearch ¶ added in v1.4.0
func GetAllGistsFromUser ¶
func GetAllGistsLikedByUser ¶ added in v1.4.0
func GetAllGistsRows ¶
func GetGistByID ¶
func (*Gist) AddAndCommitFiles ¶
func (*Gist) AppendUserLike ¶
func (*Gist) CreateForked ¶
func (*Gist) DeleteRepository ¶
func (*Gist) IncrementForkCount ¶
func (*Gist) InitRepository ¶
func (*Gist) RemoveUserLike ¶
func (*Gist) SetLastActiveNow ¶
func (*Gist) UpdatePreviewAndCount ¶
func (*Gist) UpdateServerInfo ¶
type GistDTO ¶
type GistDTO struct { Title string `validate:"max=50" form:"title"` Description string `validate:"max=150" form:"description"` Private bool `form:"private"` Files []FileDTO `validate:"min=1,dive"` }
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 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.