Documentation ¶
Index ¶
- Constants
- type Persistencer
- func (p *Persistencer) DeleteUser(hash string) error
- func (p *Persistencer) ListUser(f func(hash string, u statistic.Metadata) bool) error
- func (p *Persistencer) LoadUser(hash string) (statistic.Metadata, error)
- func (p *Persistencer) SaveUser(u statistic.Metadata) error
- func (p *Persistencer) UpdateUserTraffic(hash string, sent, recv uint64) error
- type User
Constants ¶
View Source
const Name = "sqlite"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Persistencer ¶
type Persistencer struct {
// contains filtered or unexported fields
}
func NewSqlitePersistencer ¶
func NewSqlitePersistencer(path string) (*Persistencer, error)
func (*Persistencer) DeleteUser ¶
func (p *Persistencer) DeleteUser(hash string) error
func (*Persistencer) LoadUser ¶
func (p *Persistencer) LoadUser(hash string) (statistic.Metadata, error)
func (*Persistencer) UpdateUserTraffic ¶
func (p *Persistencer) UpdateUserTraffic(hash string, sent, recv uint64) error
type User ¶
type User struct { Hash string `gorm:"primary_key"` // uint64 = 8 byte binary Sent []byte `gorm:"type:TEXT"` Recv []byte `gorm:"type:TEXT"` MaxIPNum int Password string SendLimit int RecvLimit int }
func (*User) GetIPLimit ¶
func (*User) GetKeyShare ¶
func (*User) GetSpeedLimit ¶
func (*User) GetTraffic ¶
Click to show internal directories.
Click to hide internal directories.