db

package
v0.0.0-...-a8ee971 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUnseenMegaprikolsCount

func GetUnseenMegaprikolsCount(db *pg.DB) (int, error)

func GetUser

func GetUser(db *pg.DB, u *User) error

func InitAndConnect

func InitAndConnect(callback func(db *pg.DB) error) error

func InsertUser

func InsertUser(db *pg.DB, u *User) error

func UpdateMegaprikol

func UpdateMegaprikol(db *pg.DB, m *Megaprikol) error

func UpdateUser

func UpdateUser(db *pg.DB, u *User) error

Types

type Megaprikol

type Megaprikol struct {
	Id int64 `pg:",pk"`

	Content    string `pg:",default:'',notnull"`
	PingsCount int    `pg:",default:0,notnull"`
	UsageCount int    `pg:",default:0,notnull"`
}

func GetRandomMegaprikol

func GetRandomMegaprikol(db *pg.DB) (*Megaprikol, error)

func GetUnusedMegaprikols

func GetUnusedMegaprikols(db *pg.DB) (ms []Megaprikol, err error)

func (Megaprikol) String

func (m Megaprikol) String() string

type User

type User struct {
	Id int64 `pg:",pk"`

	FullName     string `pg:",default:'',notnull"`
	Username     string `pg:",default:'',notnull"`
	ThingSize    int    `pg:",default:0,notnull"`
	LastGrowthAt time.Time
}

func GetOrUpsertUser

func GetOrUpsertUser(db *pg.DB, u *User) (*User, error)

func GetOrderedUsers

func GetOrderedUsers(db *pg.DB) (users []User, err error)

func GetRandomUsers

func GetRandomUsers(db *pg.DB, n int) (users []User, err error)

func (User) String

func (u User) String() string

Jump to

Keyboard shortcuts

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