sqlite

package
v0.0.0-...-5a5adae Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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) ListUser

func (p *Persistencer) ListUser(f func(hash string, u statistic.Metadata) bool) error

func (*Persistencer) LoadUser

func (p *Persistencer) LoadUser(hash string) (statistic.Metadata, error)

func (*Persistencer) SaveUser

func (p *Persistencer) SaveUser(u 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) GetHash

func (u *User) GetHash() string

func (*User) GetIPLimit

func (u *User) GetIPLimit() int

func (*User) GetKeyShare

func (u *User) GetKeyShare() string

func (*User) GetSpeedLimit

func (u *User) GetSpeedLimit() (sent, recv int)

func (*User) GetTraffic

func (u *User) GetTraffic() (sent, recv uint64)

Jump to

Keyboard shortcuts

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