db

package
v0.685.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	USER_PREFIX = "gramophile/user/"
)

Functions

func ResolveDiff added in v0.273.0

func ResolveDiff(update *pb.RecordUpdate) []string

Types

type DB added in v0.67.0

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) Clean added in v0.156.0

func (d *DB) Clean(ctx context.Context) error

func (*DB) DeleteRecord added in v0.249.0

func (d *DB) DeleteRecord(ctx context.Context, userid int32, iid int64) error

func (*DB) DeleteSale added in v0.532.0

func (d *DB) DeleteSale(ctx context.Context, userid int32, saleid int64) error

func (*DB) DeleteUser added in v0.67.0

func (d *DB) DeleteUser(ctx context.Context, id string) error

func (*DB) GenerateToken added in v0.67.0

func (d *DB) GenerateToken(ctx context.Context, token, secret string) (*pb.StoredUser, error)

func (*DB) GetIntent added in v0.119.0

func (d *DB) GetIntent(ctx context.Context, userid int32, iid int64) (*pb.Intent, error)

func (*DB) GetLatestSnapshot added in v0.229.0

func (d *DB) GetLatestSnapshot(ctx context.Context, user *pb.StoredUser, org string) (*pb.OrganisationSnapshot, error)

func (*DB) GetMasterWants added in v0.667.0

func (d *DB) GetMasterWants(ctx context.Context, userid int32) ([]*pb.Want, error)

func (*DB) GetRecord added in v0.67.0

func (d *DB) GetRecord(ctx context.Context, userid int32, iid int64) (*pb.Record, error)

func (*DB) GetRecords added in v0.79.0

func (d *DB) GetRecords(ctx context.Context, userid int32) ([]int64, error)

func (*DB) GetSale added in v0.300.0

func (d *DB) GetSale(ctx context.Context, userid int32, saleid int64) (*pb.SaleInfo, error)

func (*DB) GetSales added in v0.300.0

func (d *DB) GetSales(ctx context.Context, userid int32) ([]int64, error)

func (*DB) GetUpdates added in v0.213.0

func (d *DB) GetUpdates(ctx context.Context, userid int32, r *pb.Record) ([]*pb.RecordUpdate, error)

func (*DB) GetUser added in v0.67.0

func (d *DB) GetUser(ctx context.Context, user string) (*pb.StoredUser, error)

func (*DB) GetUsers added in v0.67.0

func (d *DB) GetUsers(ctx context.Context) ([]string, error)

func (*DB) GetWant added in v0.467.0

func (d *DB) GetWant(ctx context.Context, userid int32, wid int64) (*pb.Want, error)

func (*DB) GetWantUpdates added in v0.630.0

func (d *DB) GetWantUpdates(ctx context.Context, userid int32, wid int64) ([]*pb.Update, error)

func (*DB) GetWantlists added in v0.304.0

func (d *DB) GetWantlists(ctx context.Context, userid int32) ([]*pb.Wantlist, error)

func (*DB) GetWants added in v0.288.0

func (d *DB) GetWants(ctx context.Context, userid int32) ([]*pb.Want, error)

func (*DB) LoadAllRecords added in v0.304.0

func (d *DB) LoadAllRecords(ctx context.Context, userid int32) ([]*pb.Record, error)

func (*DB) LoadLogins added in v0.67.0

func (d *DB) LoadLogins(ctx context.Context) (*pb.UserLoginAttempts, error)

func (*DB) LoadMoveQuota added in v0.353.0

func (d *DB) LoadMoveQuota(ctx context.Context, userId int32) (*pb.MoveQuota, error)

func (*DB) LoadSnapshot added in v0.231.0

func (d *DB) LoadSnapshot(ctx context.Context, user *pb.StoredUser, org string, name string) (*pb.OrganisationSnapshot, error)

func (*DB) LoadWantlist added in v0.282.0

func (d *DB) LoadWantlist(ctx context.Context, user *pb.StoredUser, wantlist string) (*pb.Wantlist, error)

func (*DB) SaveIntent added in v0.120.0

func (d *DB) SaveIntent(ctx context.Context, userid int32, iid int64, i *pb.Intent) error

func (*DB) SaveLogins added in v0.67.0

func (d *DB) SaveLogins(ctx context.Context, logins *pb.UserLoginAttempts) error

func (*DB) SaveMoveQuota added in v0.353.0

func (d *DB) SaveMoveQuota(ctx context.Context, userId int32, mh *pb.MoveQuota) error

func (*DB) SaveRecord added in v0.67.0

func (d *DB) SaveRecord(ctx context.Context, userid int32, record *pb.Record) error

func (*DB) SaveRecordWithUpdate added in v0.351.0

func (d *DB) SaveRecordWithUpdate(ctx context.Context, userid int32, record *pb.Record, update *pb.RecordUpdate) error

func (*DB) SaveSale added in v0.300.0

func (d *DB) SaveSale(ctx context.Context, userid int32, sale *pb.SaleInfo) error

func (*DB) SaveSnapshot added in v0.229.0

func (d *DB) SaveSnapshot(ctx context.Context, user *pb.StoredUser, org string, snapshot *pb.OrganisationSnapshot) error

func (*DB) SaveUpdate added in v0.273.0

func (d *DB) SaveUpdate(ctx context.Context, userid int32, r *pb.Record, update *pb.RecordUpdate) error

func (*DB) SaveUser added in v0.67.0

func (d *DB) SaveUser(ctx context.Context, user *pb.StoredUser) error

func (*DB) SaveWant added in v0.288.0

func (d *DB) SaveWant(ctx context.Context, userid int32, want *pb.Want, reason string) error

func (*DB) SaveWantlist added in v0.282.0

func (d *DB) SaveWantlist(ctx context.Context, userid int32, wantlist *pb.Wantlist) error

type Database

type Database interface {
	GetRecord(ctx context.Context, userid int32, iid int64) (*pb.Record, error)
	DeleteRecord(ctx context.Context, userid int32, iid int64) error
	GetRecords(ctx context.Context, userid int32) ([]int64, error)
	LoadAllRecords(ctx context.Context, userid int32) ([]*pb.Record, error)
	SaveRecord(ctx context.Context, userid int32, record *pb.Record) error
	SaveRecordWithUpdate(ctx context.Context, userid int32, record *pb.Record, update *pb.RecordUpdate) error
	GetUpdates(ctx context.Context, userid int32, record *pb.Record) ([]*pb.RecordUpdate, error)
	SaveUpdate(ctx context.Context, userid int32, record *pb.Record, update *pb.RecordUpdate) error

	GetIntent(ctx context.Context, userid int32, iid int64) (*pb.Intent, error)
	SaveIntent(ctx context.Context, userid int32, iid int64, i *pb.Intent) error

	LoadLogins(ctx context.Context) (*pb.UserLoginAttempts, error)
	SaveLogins(ctx context.Context, logins *pb.UserLoginAttempts) error
	GenerateToken(ctx context.Context, token, secret string) (*pb.StoredUser, error)

	SaveUser(ctx context.Context, user *pb.StoredUser) error
	DeleteUser(ctx context.Context, id string) error
	GetUser(ctx context.Context, user string) (*pb.StoredUser, error)
	GetUsers(ctx context.Context) ([]string, error)

	LoadSnapshot(ctx context.Context, user *pb.StoredUser, org string, hash string) (*pb.OrganisationSnapshot, error)
	SaveSnapshot(ctx context.Context, user *pb.StoredUser, org string, snapshot *pb.OrganisationSnapshot) error
	GetLatestSnapshot(ctx context.Context, user *pb.StoredUser, org string) (*pb.OrganisationSnapshot, error)

	GetWant(ctx context.Context, userid int32, wid int64) (*pb.Want, error)
	GetWantUpdates(ctx context.Context, userid int32, wid int64) ([]*pb.Update, error)
	GetWants(ctx context.Context, userid int32) ([]*pb.Want, error)
	GetMasterWants(ctx context.Context, userid int32) ([]*pb.Want, error)
	SaveWant(ctx context.Context, userid int32, want *pb.Want, reason string) error

	SaveWantlist(ctx context.Context, userid int32, wantlist *pb.Wantlist) error
	LoadWantlist(ctx context.Context, user *pb.StoredUser, name string) (*pb.Wantlist, error)
	GetWantlists(ctx context.Context, userId int32) ([]*pb.Wantlist, error)

	SaveSale(ctx context.Context, userId int32, sale *pb.SaleInfo) error
	DeleteSale(ctx context.Context, userId int32, saleid int64) error
	GetSales(ctx context.Context, userId int32) ([]int64, error)
	GetSale(ctx context.Context, userId int32, saleId int64) (*pb.SaleInfo, error)

	Clean(ctx context.Context) error
	LoadMoveQuota(ctx context.Context, userId int32) (*pb.MoveQuota, error)
	SaveMoveQuota(ctx context.Context, userId int32, mh *pb.MoveQuota) error
}

func NewDatabase added in v0.55.0

func NewDatabase(ctx context.Context) Database

func NewTestDB added in v0.213.0

func NewTestDB(cl rstore_client.RStoreClient) Database

Jump to

Keyboard shortcuts

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