Documentation ¶
Index ¶
- Constants
- Variables
- func Action(f cli.ActionFunc) cli.ActionFunc
- func DataSource() string
- func IsProduction() bool
- func JSON(f func(*gin.Context) (interface{}, error)) gin.HandlerFunc
- func Main() error
- func OpenDatabase() (*gorm.DB, error)
- func OpenRedis() *redis.Pool
- func RandomStr(n int) string
- func Register(ens ...Engine)
- func Shell(cmd string, args ...string) error
- func Walk(fn func(Engine) error) error
- type Cache
- func (p *Cache) Flush() error
- func (p *Cache) Get(key string, val interface{}) error
- func (p *Cache) GetBytes(key string) ([]byte, error)
- func (p *Cache) Keys() ([]string, error)
- func (p *Cache) Set(key string, val interface{}, ttl time.Duration) error
- func (p *Cache) SetBytes(key string, val []byte, ttl time.Duration) error
- type Engine
- type FileSystemUploader
- type I18n
- func (p *I18n) Codes(lang string) ([]string, error)
- func (p *I18n) Del(lng, code string)
- func (p *I18n) E(lang string, code string, args ...interface{}) error
- func (p *I18n) F(lng, code string, obj interface{}) (string, error)
- func (p *I18n) Items(lng string) (map[string]interface{}, error)
- func (p *I18n) Middleware(c *gin.Context)
- func (p *I18n) Set(lng string, code, message string) error
- func (p *I18n) Sync(dir string) error
- func (p *I18n) T(lng string, code string, args ...interface{}) string
- type Locale
- type Model
- type Pagination
- type Queue
- type Security
- type Setting
- type Settings
- type Uploader
Constants ¶
View Source
const ( // TypeMARKDOWN markdown format TypeMARKDOWN = "markdown" // TypeHTML html format TypeHTML = "html" )
View Source
const (
// FormatDateInput format for date input
FormatDateInput = "2006-01-02"
)
View Source
const (
// LOCALE locale key
LOCALE = "locale"
)
Variables ¶
View Source
var ( // Version version Version string // BuildTime build time BuildTime string )
Functions ¶
Types ¶
type Engine ¶
type Engine interface { Mount(*gin.Engine) Shell() []cli.Command RegisterWorker() Atom(lang string) ([]*atom.Entry, error) Sitemap() ([]stm.URL, error) }
Engine engine
type FileSystemUploader ¶ added in v0.3.1
type FileSystemUploader struct {
// contains filtered or unexported fields
}
FileSystemUploader file-system storage
func (*FileSystemUploader) Remove ¶ added in v0.3.1
func (p *FileSystemUploader) Remove(url string) error
Remove remove file
func (*FileSystemUploader) Save ¶ added in v0.3.1
func (p *FileSystemUploader) Save(fd multipart.File, fh *multipart.FileHeader) (string, int64, error)
Save save file to file-system
type I18n ¶
I18n i18n helper
type Locale ¶
type Locale struct { Model Lang string `gorm:"not null;type:varchar(8);index" json:"lang"` Code string `gorm:"not null;index;type:VARCHAR(255)" json:"code"` Message string `gorm:"not null;type:varchar(800)" json:"message"` }
Locale locale model
type Model ¶
type Model struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Model base model
type Pagination ¶
type Pagination struct { Page int64 `json:"page"` Size int64 `json:"size"` Total int64 `json:"total"` Count int64 `json:"count"` Items []interface{} `json:"items"` }
Pagination pagination
func NewPagination ¶
func NewPagination(r *http.Request, total int64) *Pagination
NewPagination new pagination
type Queue ¶ added in v1.0.0
type Queue struct {
// contains filtered or unexported fields
}
Queue message queue
type Security ¶
Security security tools
type Setting ¶
type Setting struct { Model Key string `gorm:"not null;unique_index;type:VARCHAR(255)"` Val []byte `gorm:"not null"` Encode bool `gorm:"not null"` }
Setting setting
Click to show internal directories.
Click to hide internal directories.