orm

package
v0.0.0-...-928c572 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(dialect, arg string) *gorm.DB

Types

type Allocation

type Allocation struct {
	UserID   string `gorm:"priamry_key,size:32"`
	ServerID string `gorm:"priamry_key"`
	Port     int    `gorm:"not null,index"`
	Password string `gorm:"not null"`
}

func (Allocation) TableName

func (Allocation) TableName() string

type FlowRecord

type FlowRecord struct {
	UserID   string `gorm:"priamry_key"`
	ServerID string `gorm:"priamry_key"`
	// Port is omitted since one user cannot have multiple ports on a server
	StartTime int64 `gorm:"priamry_key"`
	Flow      int64 `gorm:"not null"`
}

func (FlowRecord) TableName

func (FlowRecord) TableName() string

type User

type User struct {
	ID    string `gorm:"priamry_key,size:32"`
	Email string `gorm:"not null"`
	Group string `gorm:"not null,DEFAULT:'default'"`
	Time  int64  `gorm:"not null,DEFAULT:current_timestamp"`

	// These fields do not conform with 3NF but for performance just keep them here.
	// Remember to update them once Group is changed.
	QuotaFlow int64 `gorm:"not null"`
	Expired   int64 `gorm:"not null"`
	Disabled  bool  `gorm:"not null"`
}

func (User) TableName

func (User) TableName() string

type VerifyCode

type VerifyCode struct {
	Email string `gorm:"priamry_key"`
	Code  string `gorm:"not null"`
	Time  int64  `gorm:"not null,DEFAULT:current_timestamp"`
}

func (VerifyCode) TableName

func (VerifyCode) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL