Documentation
¶
Index ¶
- Constants
- func CreateCertificate(ca bool, subject pkix.Name, years int) ([]byte, []byte, error)
- func WritePemFile(file, _type string, buf []byte, mode os.FileMode) error
- type Attachment
- type Card
- type Dao
- func (p *Dao) AddEmailUser(db *gorm.DB, lang, ip, name, email, password string) (*User, error)
- func (p *Dao) AddLog(db *gorm.DB, user uint, ip, lang, format string, args ...interface{}) error
- func (p *Dao) Allow(db *gorm.DB, user uint, role uint, years, months, days int) error
- func (p *Dao) Can(db *gorm.DB, user uint, name string, rty string, rid uint) bool
- func (p *Dao) Deny(db *gorm.DB, user uint, role uint) error
- func (p *Dao) GetRole(db *gorm.DB, name string, rty string, rid uint) (*Role, error)
- func (p *Dao) GetUserByEmail(db *gorm.DB, email string) (*User, error)
- func (p *Dao) GetUserByUID(db *gorm.DB, uid string) (*User, error)
- func (p *Dao) Is(db *gorm.DB, user uint, names ...string) bool
- func (p *Dao) SignIn(db *gorm.DB, lang, ip, email, password string) (*User, error)
- type FriendLink
- type HTMLHandlerFunc
- type Layout
- func (p *Layout) Backend(c *gin.Context) string
- func (p *Layout) CurrentUserMiddleware(c *gin.Context)
- func (p *Layout) Frontend(c *gin.Context) string
- func (p *Layout) HTML(name string, handler HTMLHandlerFunc) gin.HandlerFunc
- func (p *Layout) JSON(fn ObjectHandlerFunc) gin.HandlerFunc
- func (p *Layout) MustAdminMiddleware(c *gin.Context)
- func (p *Layout) MustSignInMiddleware(c *gin.Context)
- func (p *Layout) Redirect(to string, fn RedirectHandlerFunc) gin.HandlerFunc
- func (p *Layout) Save(c *gin.Context, s *sessions.Session)
- func (p *Layout) Session(c *gin.Context) *sessions.Session
- func (p *Layout) XML(fn ObjectHandlerFunc) gin.HandlerFunc
- type LeaveWord
- type Link
- type Log
- type ObjectHandlerFunc
- type Plugin
- type Policy
- type RedirectHandlerFunc
- type Role
- type User
- type Vote
Constants ¶
View Source
const ( // NOTICE notice NOTICE = "notice" // WARNING warning WARNING = "warning" // ERROR error ERROR = "error" // TITLE title TITLE = "title" // MESSAGE message MESSAGE = "message" // UID uid UID = "uid" // CurrentUser current user CurrentUser = "current-user" // IsAdmin is admin? IsAdmin = "is-admin" )
View Source
const ( // RoleAdmin admin role RoleAdmin = "admin" // RoleRoot root role RoleRoot = "root" // UserTypeEmail email user UserTypeEmail = "email" // DefaultResourceType default resource type DefaultResourceType = "" // DefaultResourceID default resourc id DefaultResourceID = 0 )
View Source
const (
// SendEmailJob send email
SendEmailJob = "send.email"
)
Variables ¶
This section is empty.
Functions ¶
func CreateCertificate ¶
CreateCertificate create certs
Types ¶
type Attachment ¶
type Attachment struct {
ID uint `json:"id" gorm:"primary_key"`
Title string `json:"title"`
URL string `json:"url"`
Length int64 `json:"length"`
MediaType string `json:"mediaType"`
ResourceID uint `json:"resourceId" sql:",notnull"`
ResourceType string `json:"resourceType" sql:",notnull"`
User User `json:"user"`
UserID uint `json:"userId"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"crateAt"`
}
Attachment attachment
type Card ¶
type Card struct {
ID uint `json:"id" gorm:"primary_key"`
Lang string `json:"lang"`
Loc string `json:"loc"`
Title string `json:"title"`
Summary string `json:"summary"`
Type string `json:"type"`
Href string `json:"href"`
Logo string `json:"logo"`
SortOrder int `json:"sortOrder" sql:",notnull"`
Action string `json:"action"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
}
Card card
type Dao ¶
Dao dao
func (*Dao) AddEmailUser ¶
AddEmailUser add email user
func (*Dao) GetUserByEmail ¶
GetUserByEmail get user by email
func (*Dao) GetUserByUID ¶
GetUserByUID get user by uid
type FriendLink ¶
type FriendLink struct {
ID uint `json:"id" gorm:"primary_key"`
Title string `json:"title"`
Home string `json:"home"`
Logo string `json:"logo"`
SortOrder int `json:"sortOrder"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
}
FriendLink friend_links
type HTMLHandlerFunc ¶
HTMLHandlerFunc html handler func
type Layout ¶
type Layout struct {
Render *render.Render `inject:""`
Dao *Dao `inject:""`
Store sessions.Store `inject:""`
Jwt *web.Jwt `inject:""`
DB *gorm.DB `inject:""`
I18n *web.I18n `inject:""`
Languages []string `inject:"languages"`
}
Layout layout
func (*Layout) CurrentUserMiddleware ¶
CurrentUserMiddleware current user middleware
func (*Layout) HTML ¶
func (p *Layout) HTML(name string, handler HTMLHandlerFunc) gin.HandlerFunc
HTML wrap html
func (*Layout) MustAdminMiddleware ¶
MustAdminMiddleware must admin middleware
func (*Layout) MustSignInMiddleware ¶
MustSignInMiddleware must sign in middleware
func (*Layout) Redirect ¶
func (p *Layout) Redirect(to string, fn RedirectHandlerFunc) gin.HandlerFunc
Redirect redirect
type LeaveWord ¶
type LeaveWord struct {
ID uint `json:"id" gorm:"primary_key"`
Body string `json:"body"`
Type string `json:"type"`
CreatedAt time.Time `json:"createdAt"`
}
LeaveWord leave-word
type Link ¶
type Link struct {
ID uint `json:"id" gorm:"primary_key"`
Lang string `json:"lang"`
Loc string `json:"loc"`
Href string `json:"href"`
Label string `json:"label"`
SortOrder int `json:"sortOrder"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
}
Link link
type Log ¶
type Log struct {
ID uint `json:"id" gorm:"primary_key"`
Message string `json:"message"`
IP string `json:"ip"`
User User `json:"user"`
UserID uint `json:"userId"`
CreatedAt time.Time `json:"createdAt"`
}
Log log
type ObjectHandlerFunc ¶
ObjectHandlerFunc object handle func
type Plugin ¶
type Plugin struct {
I18n *web.I18n `inject:""`
Cache *web.Cache `inject:""`
Jwt *web.Jwt `inject:""`
Jobber *web.Jobber `inject:""`
Settings *web.Settings `inject:""`
Security *web.Security `inject:""`
S3 *web.S3 `inject:""`
Sitemap *web.Sitemap `inject:""`
RSS *web.RSS `inject:""`
Router *gin.Engine `inject:""`
DB *gorm.DB `inject:""`
Redis *redis.Pool `inject:""`
Render *render.Render `inject:""`
Dao *Dao `inject:""`
Layout *Layout `inject:""`
Languages []string `inject:"languages"`
}
Plugin plugin
type Policy ¶
type Policy struct {
ID uint `gorm:"primary_key"`
StartUp time.Time
ShutDown time.Time
User User
UserID uint
Role Role
RoleID uint
UpdatedAt time.Time
CreatedAt time.Time
}
Policy policy
type RedirectHandlerFunc ¶
RedirectHandlerFunc redirect handle func
type Role ¶
type Role struct {
ID uint `gorm:"primary_key"`
Name string
ResourceID uint
ResourceType string
UpdatedAt time.Time
CreatedAt time.Time
}
Role role
type User ¶
type User struct {
ID uint `json:"id" gorm:"primary_key"`
Name string `json:"name"`
Email string `json:"email"`
UID string `json:"uid" gorm:"column:uid"`
Password []byte `json:"-"`
ProviderID string `json:"providerId"`
ProviderType string `json:"providerType"`
Logo string `json:"logo"`
SignInCount uint `json:"signInCount"`
LastSignInAt *time.Time `json:"lastSignInAt"`
LastSignInIP string `json:"lastSignInIp"`
CurrentSignInAt *time.Time `json:"currentSignInAt"`
CurrentSignInIP string `json:"currentSignInIp"`
ConfirmedAt *time.Time `json:"confirmedAt"`
LockedAt *time.Time `json:"lockAt"`
Logs []Log `json:"logs"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
}
User user
func (*User) SetGravatarLogo ¶
func (p *User) SetGravatarLogo()
SetGravatarLogo set logo by gravatar
Click to show internal directories.
Click to hide internal directories.