Documentation ¶
Index ¶
- Variables
- func Alloc(size int) []int64
- func ComparePasswordAndStr(password, hash string) bool
- func CreateDB(callback func(db *gorm.DB)) *gorm.DB
- func DataSourceClose()
- func DataSourceConnect(callback func(db *gorm.DB))
- func Free(mem []int64)
- func GenRandomString(len int) string
- func GeneratePassword(password string) string
- func GenerateToken(claims jwt.Claims) (string, error)
- func JSON(c echo.Context, result *Result) error
- func JwtConfig(skiper middleware.Skipper) (jwtConfig middleware.JWTConfig)
- func MD5(text string) string
- func Map2Struct(data map[string]interface{}, obj interface{}) error
- func MongoDbConnect()
- func RedisClose()
- func RedisConnect()
- func RedisStats()
- func Server(e *echo.Echo)
- func SetField(obj interface{}, name string, value interface{}) error
- func Struct2Map(obj interface{}) map[string]interface{}
- func TypeConversion(value string, ntype string) (reflect.Value, error)
- type DbConfig
- type Error
- type JWTConfig
- type Map
- type Optional
- type Result
- type SyncPool
- type User
- type UserWechat
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *gorm.DB
Db 数据库操作
View Source
var DefaultJWTConfig = JWTConfig{ Claims: nil, SigningMethod: jwt.SigningMethodHS256.Name, ContextKey: "user", SigningKey: []byte("ironman"), TokenLookup: "header:" + echo.HeaderAuthorization, AuthScheme: "Bearer", }
DefaultJWTConfig 默认JWT配置
View Source
var MongoSession *mgo.Session
MongoSession
View Source
var Redis *redis.Client
Redis 客户端
Functions ¶
func ComparePasswordAndStr ¶
ComparePasswordAndStr 比较密码
func DataSourceClose ¶ added in v0.0.3
func DataSourceClose()
func DataSourceConnect ¶
DataSourceConnect 初始化数据库链接
func JwtConfig ¶
func JwtConfig(skiper middleware.Skipper) (jwtConfig middleware.JWTConfig)
JwtConfig 设置JWT 配置
func Map2Struct ¶
Map2Struct map转Struct
func RedisClose ¶ added in v0.0.8
func RedisClose()
func RedisStats ¶ added in v0.0.8
func RedisStats()
Types ¶
type DbConfig ¶
type DbConfig struct { Host string Port int16 User string Password string DBName string MaxIdleConns int MaxOpenConns int ConnMaxLifetime int }
DbConfig 数据库配置
type Error ¶
type Error struct { Code int `json:"code"` Key string `json:"error,omitempty"` Message interface{} `json:"message"` }
Error 异常结构
type JWTConfig ¶
type JWTConfig struct { Claims jwt.Claims SigningMethod string ContextKey string SigningKey []byte TokenLookup string AuthScheme string // contains filtered or unexported fields }
JWTConfig JWT配置
type Result ¶
type Result struct { Code int `json:"code"` Data interface{} `json:"data,omitempty"` }
Result 返回结果
type SyncPool ¶
type SyncPool struct {
// contains filtered or unexported fields
}
SyncPool is a sync.Pool base slab allocation memory pool
var DEFAULT_SYNC_POOL *SyncPool
DEFAULT_SYNC_POOL 默認對象池
type User ¶
type User struct { ID int `json:"id" gorm:"primary_key"` Version int `json:"version,omitempty"gorm:"column:_version"` ParentID int `json:"parentId,omitempty" gorm:"column:parent_id"` NickName string `json:"nick_name" gorm:"column:nick_name"` UserName string `json:"userName,omitempty" gorm:"column:user_name"` RealName string `json:"realName,omitempty" gorm:"column:real_name"` Password string `json:"password,omitempty" gorm:"column:password"` Type int8 `json:"type,omitempty"` Sex int `json:"sex,omitempty"` Avatar string `json:"avatar,omitempty"` City string `json:"city,omitempty"` Province string `json:"province,omitempty"` Country string `json:"country,omitempty"` Email string `json:"email,omitempty"` Mobile string `json:"mobile,omitempty"` Score int `json:"score"` RegTime int64 `json:"regTime,omitempty"` UpgradedAt int64 `json:"upgradedAt,omitempty" gorm:"column:upgraded_at"` CreatedAt int64 `json:"createdAt,omitempty" gorm:"column:created_at"` UpdatedAt int64 `json:"updatedAt,omitempty" gorm:"column:updated_at"` }
User 用户基础信息
type UserWechat ¶
type UserWechat struct { ID int `json:"id" gorm:"primary_key"` UnionID string `json:"unionId" gorm:"column:unionid"` OpenID string `json:"openId" gorm:"column:openid"` CreatedAt int64 `json:"created_at" gorm:"column:created_at"` UpdatedAt int64 `json:"updated_at" gorm:"column:updated_at"` }
UserWechat 用户微信信息
Source Files ¶
Click to show internal directories.
Click to hide internal directories.