sqlc

package
v0.0.0-...-78e30ec Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        uuid.UUID        `db:"id" json:"id"`
	PostID    uuid.UUID        `db:"post_id" json:"post_id"`
	UserID    uuid.UUID        `db:"user_id" json:"user_id"`
	Content   string           `db:"content" json:"content"`
	CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
}

type CreatePostParams

type CreatePostParams struct {
	UserID  uuid.UUID `db:"user_id" json:"user_id"`
	Content string    `db:"content" json:"content"`
}

type CreateUserParams

type CreateUserParams struct {
	Username     string `db:"username" json:"username"`
	PasswordHash string `db:"password_hash" json:"password_hash"`
	Salt         string `db:"salt" json:"salt"`
	Email        string `db:"email" json:"email"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Dislike

type Dislike struct {
	ID        uuid.UUID        `db:"id" json:"id"`
	PostID    uuid.UUID        `db:"post_id" json:"post_id"`
	UserID    uuid.UUID        `db:"user_id" json:"user_id"`
	CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
}

type Gender

type Gender string
const (
	GenderMale   Gender = "male"
	GenderFemale Gender = "female"
)

func (*Gender) Scan

func (e *Gender) Scan(src interface{}) error

type GetPopularPostsParams

type GetPopularPostsParams struct {
	Limit  int32 `db:"limit" json:"limit"`
	Offset int32 `db:"offset" json:"offset"`
}

type GetUserRow

type GetUserRow struct {
	ID           uuid.UUID `db:"id" json:"id"`
	PasswordHash string    `db:"password_hash" json:"password_hash"`
	Salt         string    `db:"salt" json:"salt"`
}

type LanguagePreference

type LanguagePreference string
const (
	LanguagePreferenceEn LanguagePreference = "en"
	LanguagePreferenceRu LanguagePreference = "ru"
)

func (*LanguagePreference) Scan

func (e *LanguagePreference) Scan(src interface{}) error

type Like

type Like struct {
	ID        uuid.UUID        `db:"id" json:"id"`
	PostID    uuid.UUID        `db:"post_id" json:"post_id"`
	UserID    uuid.UUID        `db:"user_id" json:"user_id"`
	CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
}

type NullGender

type NullGender struct {
	Gender Gender `json:"gender"`
	Valid  bool   `json:"valid"` // Valid is true if Gender is not NULL
}

func (*NullGender) Scan

func (ns *NullGender) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullGender) Value

func (ns NullGender) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullLanguagePreference

type NullLanguagePreference struct {
	LanguagePreference LanguagePreference `json:"language_preference"`
	Valid              bool               `json:"valid"` // Valid is true if LanguagePreference is not NULL
}

func (*NullLanguagePreference) Scan

func (ns *NullLanguagePreference) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullLanguagePreference) Value

func (ns NullLanguagePreference) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Post

type Post struct {
	ID        uuid.UUID        `db:"id" json:"id"`
	UserID    uuid.UUID        `db:"user_id" json:"user_id"`
	Content   string           `db:"content" json:"content"`
	CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
	Views     *int32           `db:"views" json:"views"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreatePost

func (q *Queries) CreatePost(ctx context.Context, arg CreatePostParams) (Post, error)

func (*Queries) CreateUser

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

func (*Queries) GetEmailById

func (q *Queries) GetEmailById(ctx context.Context, id uuid.UUID) (string, error)

func (*Queries) GetPopularPosts

func (q *Queries) GetPopularPosts(ctx context.Context, arg GetPopularPostsParams) ([]Post, error)

func (*Queries) GetPostById

func (q *Queries) GetPostById(ctx context.Context, id uuid.UUID) (Post, error)

func (*Queries) GetUser

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

func (*Queries) GetUserById

func (q *Queries) GetUserById(ctx context.Context, id uuid.UUID) (User, error)

func (*Queries) ListPosts

func (q *Queries) ListPosts(ctx context.Context) ([]Post, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context) ([]User, error)

func (*Queries) VerifyEmail

func (q *Queries) VerifyEmail(ctx context.Context, id uuid.UUID) error

func (*Queries) WithTx

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

type User

type User struct {
	ID                  uuid.UUID              `db:"id" json:"id"`
	Username            string                 `db:"username" json:"username"`
	PasswordHash        string                 `db:"password_hash" json:"password_hash"`
	Salt                string                 `db:"salt" json:"salt"`
	Email               string                 `db:"email" json:"email"`
	EmailVerified       *bool                  `db:"email_verified" json:"email_verified"`
	FirstName           *string                `db:"first_name" json:"first_name"`
	LastName            *string                `db:"last_name" json:"last_name"`
	PhoneNumber         *string                `db:"phone_number" json:"phone_number"`
	DateOfBirth         pgtype.Date            `db:"date_of_birth" json:"date_of_birth"`
	Gender              NullGender             `db:"gender" json:"gender"`
	Bio                 *string                `db:"bio" json:"bio"`
	LanguagePreference  NullLanguagePreference `db:"language_preference" json:"language_preference"`
	CreatedAt           pgtype.Timestamp       `db:"created_at" json:"created_at"`
	UpdatedAt           pgtype.Timestamp       `db:"updated_at" json:"updated_at"`
	FailedLoginAttempts *int32                 `db:"failed_login_attempts" json:"failed_login_attempts"`
}

Jump to

Keyboard shortcuts

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