model

package
v0.0.0-...-f9d4dce Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	UserID uint64 `ydb:"user_id,primary"`

	Name   *string `ydb:"name"`
	Phone  *string `ydb:"phone"`
	Email  *string `ydb:"email"`
	Source string  `ydb:"source"`
}

type ProfileRepo

type ProfileRepo struct {
	DB ydb.Connection
}

func (*ProfileRepo) CreateTable

func (ur *ProfileRepo) CreateTable(ctx context.Context) (err error)

func (*ProfileRepo) Delete

func (ur *ProfileRepo) Delete(ctx context.Context, userID uint64) (err error)

func (*ProfileRepo) Get

func (ur *ProfileRepo) Get(ctx context.Context, userID uint64) (u *Profile, err error)

func (*ProfileRepo) Insert

func (ur *ProfileRepo) Insert(ctx context.Context, u *Profile) (err error)

func (*ProfileRepo) Upsert

func (ur *ProfileRepo) Upsert(ctx context.Context, u *Profile) (err error)

type Subscription

type Subscription struct {
	UserID uint64 `ydb:"user_id,primary"`
	Topic  string `ydb:"topic,primary"`

	Active bool `ydb:"active"`

	CreatedAt  time.Time `ydb:"created_at"`
	LastAction time.Time `ydb:"last_action"`
}

func (*Subscription) BeforeInsert

func (u *Subscription) BeforeInsert()

func (*Subscription) BeforeUpdate

func (u *Subscription) BeforeUpdate()

type SubscriptionRepo

type SubscriptionRepo struct {
	DB ydb.Connection
}

func (*SubscriptionRepo) CreateTable

func (ur *SubscriptionRepo) CreateTable(ctx context.Context) (err error)

func (*SubscriptionRepo) Delete

func (ur *SubscriptionRepo) Delete(ctx context.Context, userID uint64, topic string) (err error)

func (*SubscriptionRepo) DeleteByUserID

func (ur *SubscriptionRepo) DeleteByUserID(ctx context.Context, userID uint64) (err error)

func (*SubscriptionRepo) Get

func (ur *SubscriptionRepo) Get(ctx context.Context, userID uint64, topic string) (u *Subscription, err error)

func (*SubscriptionRepo) GetByUserID

func (ur *SubscriptionRepo) GetByUserID(ctx context.Context, userID uint64) (ss []*Subscription, err error)

func (*SubscriptionRepo) Insert

func (ur *SubscriptionRepo) Insert(ctx context.Context, u *Subscription) (err error)

func (*SubscriptionRepo) Upsert

func (ur *SubscriptionRepo) Upsert(ctx context.Context, u *Subscription) (err error)

type TelegramProfile

type TelegramProfile struct {
	UserID uint64 `ydb:"user_id,primary"`

	Username     string `ydb:"username"`
	FirstName    string `ydb:"first_name"`
	LastName     string `ydb:"last_name"`
	LanguageCode string `ydb:"language_code"`
}

type TelegramProfileRepo

type TelegramProfileRepo struct {
	DB ydb.Connection
}

func (*TelegramProfileRepo) CreateTable

func (ur *TelegramProfileRepo) CreateTable(ctx context.Context) (err error)

func (*TelegramProfileRepo) Delete

func (ur *TelegramProfileRepo) Delete(ctx context.Context, userID uint64) (err error)

func (*TelegramProfileRepo) Get

func (ur *TelegramProfileRepo) Get(ctx context.Context, userID uint64) (u *TelegramProfile, err error)

func (*TelegramProfileRepo) Insert

func (ur *TelegramProfileRepo) Insert(ctx context.Context, u *TelegramProfile) (err error)

func (*TelegramProfileRepo) Upsert

func (ur *TelegramProfileRepo) Upsert(ctx context.Context, u *TelegramProfile) (err error)

type User

type User struct {
	UserID uint64 `ydb:"user_id,primary"`
	Role   uint8  `ydb:"role"`

	State   string `ydb:"state"`
	Context string `ydb:"context"`

	CreatedAt  time.Time `ydb:"created_at"`
	LastAction time.Time `ydb:"last_action"`
	Version    uint32    `ydb:"version"`
}

func (*User) BeforeInsert

func (u *User) BeforeInsert()

func (*User) BeforeUpdate

func (u *User) BeforeUpdate()

type UserRepo

type UserRepo struct {
	DB ydb.Connection
}

func (*UserRepo) CreateTable

func (ur *UserRepo) CreateTable(ctx context.Context) (err error)

func (*UserRepo) Delete

func (ur *UserRepo) Delete(ctx context.Context, userID uint64) (err error)

func (*UserRepo) Get

func (ur *UserRepo) Get(ctx context.Context, userID uint64) (u *User, err error)

func (*UserRepo) Insert

func (ur *UserRepo) Insert(ctx context.Context, u *User) (err error)

func (*UserRepo) Upsert

func (ur *UserRepo) Upsert(ctx context.Context, u *User) (err error)

Jump to

Keyboard shortcuts

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