Documentation ¶
Index ¶
- func Disconnect() error
- func DoTransaction(fc func(tx *gorm.DB) error) error
- func InitDB()
- func InitRedis()
- func RedisDecr(key string) (int64, error)
- func RedisDelete(key string) error
- func RedisExist(key string) bool
- func RedisGet(key string, out interface{}) error
- func RedisGetInt(key string) (int64, error)
- func RedisGetString(key string) (string, error)
- func RedisIncr(key string) (int64, error)
- func RedisSet(key string, val interface{}, expire time.Duration) error
- func RedisSetBytes(key string, val interface{}, expire time.Duration) error
- func RedisSetString(key string, val string, expire time.Duration) error
- type Application
- type ShortLink
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoTransaction ¶
DoTransaction do transaction
func RedisGetInt ¶ added in v1.0.2
RedisGetInt get int64
func RedisGetString ¶ added in v1.0.2
RedisGetString get string
func RedisSetBytes ¶
RedisSetBytes set bytes
Types ¶
type Application ¶
type Application struct { gorm.Model Name string `gorm:"unique;unique_index"` Usage uint64 `gorm:"not null;default:0"` Liked uint64 `gorm:"not null;default:0"` }
Application list of applications
func (*Application) FindWithTx ¶
func (a *Application) FindWithTx(tx *gorm.DB) error
FindWithTx populate current object with transaction
func (*Application) SaveWithTx ¶
func (a *Application) SaveWithTx(tx *gorm.DB) error
SaveWithTx save application with transaction
type ShortLink ¶ added in v1.1.8
type ShortLink struct { gorm.Model Link *string `gorm:"not null"` Usage uint64 `gorm:"not null;default:0"` UserID uint }
ShortLink database entity
func (*ShortLink) FindWithTx ¶ added in v1.1.8
FindWithTx populate current object with transaction
type User ¶
type User struct { gorm.Model Username string `gorm:"unique_index"` Password string Email string `gorm:"primary_key;unique"` GoogleID string LikedApps pq.StringArray `gorm:"type:text[]"` ShortLinks []ShortLink }
User database entity
func (*User) FindWithTx ¶
FindWithTx populate current object with transaction
Click to show internal directories.
Click to hide internal directories.