Documentation
¶
Index ¶
- func CheckSafe(directory string, base string) bool
- func CreateFilePath(dir string, name string) string
- func DeleteComment(id int64) error
- func DeleteOldTags() error
- func DeletePostById(id int64) error
- func DeletePostTagsByPostId(post_id int64) error
- func EncryptPassword(password string) (string, error)
- func GenerateJWTKeys(bits int) ([]byte, []byte, error)
- func GenerateSlug(input string, table string) string
- func GetNumberOfComments() (int64, error)
- func GetNumberOfPosts(isPage bool, published bool) (int64, error)
- func GetNumberOfUsers() (int64, error)
- func GetSettingValue(k string) string
- func Initialize(dbPath string, dbExists bool) error
- func InitializeKey(privKeyPath, pubKeyPath string)
- func InsertPostTag(post_id int64, tag_id int64) error
- func InsertRoleUser(role_id int, user_id int64) error
- func PostChangeSlug(slug string) bool
- func RemoveFile(path string) error
- func SetMessageGenerator(name string, fn func(v interface{}) string)
- func SetNavigators(labels, urls []string) error
- func SetSettingIfNotExists(k, v, t string) error
- func ValidateJWT(t string) (*jwt.Token, error)
- type Comment
- func (comment *Comment) GetCommentById() error
- func (comment *Comment) ParentComment() (*Comment, error)
- func (c *Comment) ParentContent() string
- func (comment *Comment) Post() *Post
- func (c *Comment) Save() error
- func (c *Comment) ToJson() map[string]interface{}
- func (c *Comment) ValidateComment() string
- type Comments
- type File
- type JWT
- type Message
- type Messages
- type Navigator
- type NullTime
- type Post
- func (p *Post) Author() *User
- func (p *Post) Comments() []*Comment
- func (p *Post) Excerpt() string
- func (post *Post) GetPostById() error
- func (post *Post) GetPostBySlug(slug string) error
- func (p *Post) Insert() error
- func (p *Post) Save(tags ...*Tag) error
- func (p *Post) Summary() string
- func (p *Post) TagString() string
- func (p *Post) Tags() []*Tag
- func (p *Post) Update() error
- func (p *Post) UpdateFromRequest(r *http.Request)
- func (p *Post) Url() string
- type Posts
- func (p Posts) Get(i int) *Post
- func (posts *Posts) GetAllPostList(isPage bool, onlyPublished bool, orderBy string) error
- func (posts *Posts) GetAllPostsByTag(tagId int64) error
- func (posts *Posts) GetPostList(page, size int64, isPage bool, onlyPublished bool, orderBy string) (*utils.Pager, error)
- func (posts *Posts) GetPostsByTag(tagId, page, size int64, onlyPublished bool) (*utils.Pager, error)
- func (p Posts) Len() int
- type Row
- type Setting
- type Settings
- type Statis
- type Tag
- type Tags
- type Token
- type User
- func (u *User) Avatar() string
- func (u *User) ChangePassword(password string) error
- func (u *User) CheckPassword(password string) bool
- func (u *User) Create(password string) error
- func (user *User) GetUserByEmail() error
- func (user *User) GetUserById() error
- func (user *User) GetUserByName() error
- func (user *User) GetUserBySlug() error
- func (u *User) Insert() error
- func (u *User) Save() error
- func (u *User) Update() error
- func (u User) UserEmailExist() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSafe ¶
Checks if directory is a child directory of base, make sure that GetFileList won't read any folder other than the upload folder.
func CreateFilePath ¶
func DeleteComment ¶
func DeleteOldTags ¶
func DeleteOldTags() error
func DeletePostById ¶
func DeletePostTagsByPostId ¶
func EncryptPassword ¶
func GenerateSlug ¶
func GetNumberOfComments ¶
func GetNumberOfUsers ¶
func GetSettingValue ¶
func Initialize ¶
func InitializeKey ¶
func InitializeKey(privKeyPath, pubKeyPath string)
func InsertPostTag ¶
func InsertRoleUser ¶
func PostChangeSlug ¶
func RemoveFile ¶
func SetMessageGenerator ¶
func SetNavigators ¶
func SetSettingIfNotExists ¶
Types ¶
type Comment ¶
type Comment struct { Id int64 `meddler:"id,pk"` PostId int64 `meddler:"post_id"` Author string `meddler:"author"` Email string `meddler:"author_email"` Avatar string `meddler:"author_avatar"` Website string `meddler:"author_url"` Ip string `meddler:"author_ip"` CreatedAt *time.Time `meddler:"created_at"` Content string `meddler:"content"` Approved bool `meddler:"approved"` UserAgent string `meddler:"agent"` Type string `meddler:"type"` Parent int64 `meddler:"parent"` UserId int64 `meddler:"user_id"` Children *Comments `meddler:"-"` }
Comment struct defines a comment item data.
func NewComment ¶
func NewComment() *Comment
func (*Comment) GetCommentById ¶
func (*Comment) ParentComment ¶
func (*Comment) ParentContent ¶
func (*Comment) ValidateComment ¶
type Comments ¶
type Comments []*Comment
func (*Comments) GetCommentList ¶
func (*Comments) GetCommentsByPostId ¶
type File ¶
func GetFileList ¶
type JWT ¶
type JWT struct { UserRole int `json:"user_role"` UserID int64 `json:"user_id"` UserEmail string `json:"user_email"` Expiration int64 `json:"expiration"` Token string `json:"token"` }
func NewJWTFromToken ¶
type Message ¶
type Message struct { Id int `meddler:"id,pk"` Type string `meddler:"type"` Data string `meddler:"data"` IsRead bool `meddler:"is_read"` CreatedAt *time.Time `meddler:"created_at"` }
func NewMessage ¶
type Messages ¶
type Messages []*Message
func (*Messages) GetUnreadMessages ¶
func (messages *Messages) GetUnreadMessages()
type Post ¶
type Post struct { Id int64 `meddler:"id,pk"` Title string `meddler:"title"` Slug string `meddler:"slug"` Markdown string `meddler:"markdown"` Html string `meddler:"html"` Image string `meddler:"image"` IsFeatured bool `meddler:"featured"` IsPage bool `meddler:"page"` AllowComment bool `meddler:"allow_comment"` CommentNum int64 `meddler:"comment_num"` IsPublished bool `meddler:"published"` Language string `meddler:"language"` MetaTitle string `meddler:"meta_title"` MetaDescription string `meddler:"meta_description"` CreatedAt *time.Time `meddler:"created_at"` CreatedBy int64 `meddler:"created_by"` UpdatedAt *time.Time `meddler:"updated_at"` UpdatedBy int64 `meddler:"updated_by"` PublishedAt *time.Time `meddler:"published_at"` PublishedBy int64 `meddler:"published_by"` Hits int64 `meddler:"-"` Category string `meddler:"-"` }
func (*Post) GetPostById ¶
func (*Post) GetPostBySlug ¶
func (*Post) UpdateFromRequest ¶
type Posts ¶
type Posts []*Post
func (*Posts) GetAllPostList ¶
func (*Posts) GetAllPostsByTag ¶
func (*Posts) GetPostList ¶
func (*Posts) GetPostsByTag ¶
type Setting ¶
type Setting struct { Id int `meddler:"id,pk"` Key string `meddler:"key"` Value string `meddler:"value"` Type string `meddler:"type"` // general, content, navigation, custom CreatedAt *time.Time `meddler:"created_at"` CreatedBy int64 `meddler:"created_by"` UpdatedAt *time.Time `meddler:"updated_at"` UpdatedBy int64 `meddler:"updated_by"` }
func NewSetting ¶
func (*Setting) GetSetting ¶
type Settings ¶
type Settings []*Setting
func GetCustomSettings ¶
func GetCustomSettings() *Settings
func GetSettingsByType ¶
type Tag ¶
type Tag struct { Id int64 `meddler:"id,pk"` Name string `meddler:"name"` Slug string `meddler:"slug"` Hidden bool `meddler:"hidden"` CreatedAt *time.Time `meddler:"created_at"` CreatedBy int64 `meddler:"created_by"` UpdatedAt *time.Time `meddler:"updated_at"` UpdatedBy int64 `meddler:"updated_by"` }
func (*Tag) GetTagBySlug ¶
type Token ¶
type Token struct { Id int64 `meddler:"id,pk"` Value string `meddler:"value"` UserId int64 `meddler:"user_id"` CreatedAt *time.Time `meddler:"created_at"` ExpiredAt *time.Time `meddler:"expired_at"` }
func (*Token) GetTokenByValue ¶
type User ¶
type User struct { Id int64 `meddler:"id,pk"` Name string `meddler:"name"` Slug string `meddler:"slug"` HashedPassword string `meddler:"password"` Email string `meddler:"email"` Image string `meddler:"image"` // NULL Cover string `meddler:"cover"` // NULL Bio string `meddler:"bio"` // NULL Website string `meddler:"website"` // NULL Location string `meddler:"location"` // NULL Accessibility string `meddler:"accessibility"` Status string `meddler:"status"` Language string `meddler:"language"` Lastlogin *time.Time `meddler:"last_login"` CreatedAt *time.Time `meddler:"created_at"` CreatedBy int `meddler:"created_by"` UpdatedAt *time.Time `meddler:"updated_at"` UpdatedBy int `meddler:"updated_by"` Role int `meddler:"-"` //1 = Administrator, 2 = Editor, 3 = Author, 4 = Owner }
func (*User) ChangePassword ¶
func (*User) CheckPassword ¶
func (*User) GetUserByEmail ¶
func (*User) GetUserById ¶
func (*User) GetUserByName ¶
func (*User) GetUserBySlug ¶
func (User) UserEmailExist ¶
Click to show internal directories.
Click to hide internal directories.