db

package
v0.0.0-...-aa37512 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateFollowerParams

type CreateFollowerParams struct {
	FollowerID string `json:"follower_id"`
	FolloweeID string `json:"followee_id"`
}

type CreateUserParams

type CreateUserParams struct {
	Username       string    `json:"username"`
	HashedPassword string    `json:"hashed_password"`
	FullName       string    `json:"full_name"`
	Email          string    `json:"email"`
	DateOfBirth    time.Time `json:"date_of_birth"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteFollowerParams

type DeleteFollowerParams struct {
	FollowerID string `json:"follower_id"`
	FolloweeID string `json:"followee_id"`
}

type ListFolloweesParams

type ListFolloweesParams struct {
	FollowerID string `json:"follower_id"`
	Limit      int32  `json:"limit"`
	Offset     int32  `json:"offset"`
}

type ListFollowersParams

type ListFollowersParams struct {
	FolloweeID string `json:"followee_id"`
	Limit      int32  `json:"limit"`
	Offset     int32  `json:"offset"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateFollower

func (q *Queries) CreateFollower(ctx context.Context, arg CreateFollowerParams) (UserFollower, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteFollower

func (q *Queries) DeleteFollower(ctx context.Context, arg DeleteFollowerParams) error

func (*Queries) GetFolloweesCount

func (q *Queries) GetFolloweesCount(ctx context.Context, followerID string) (int64, error)

func (*Queries) GetFollowersCount

func (q *Queries) GetFollowersCount(ctx context.Context, followeeID string) (int64, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, username string) (User, error)

func (*Queries) ListFollowees

func (q *Queries) ListFollowees(ctx context.Context, arg ListFolloweesParams) ([]UserFollower, error)

func (*Queries) ListFollowers

func (q *Queries) ListFollowers(ctx context.Context, arg ListFollowersParams) ([]UserFollower, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type User

type User struct {
	Username          string    `json:"username"`
	HashedPassword    string    `json:"hashed_password"`
	FullName          string    `json:"full_name"`
	Email             string    `json:"email"`
	DateOfBirth       time.Time `json:"date_of_birth"`
	PasswordChangedAt time.Time `json:"password_changed_at"`
	CreatedAt         time.Time `json:"created_at"`
}

type UserFollower

type UserFollower struct {
	FollowerID string `json:"follower_id"`
	FolloweeID string `json:"followee_id"`
}

Jump to

Keyboard shortcuts

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