database

package
v0.0.0-...-a0bf825 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blogpost

type Blogpost struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Body      string
	UserID    uuid.UUID
}

type CreateBlogPostParams

type CreateBlogPostParams struct {
	Body   string
	UserID uuid.UUID
}

type CreateUserParams

type CreateUserParams struct {
	Email          string
	HashedPassword string
}

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 DeleteBlogPostParams

type DeleteBlogPostParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type GetEncryptedPasswordRow

type GetEncryptedPasswordRow struct {
	HashedPassword string
	ID             uuid.UUID
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Email          string
	IsChirpyRed    sql.NullBool
}

type GetRefreshTokenRow

type GetRefreshTokenRow struct {
	Token     string
	UserID    uuid.UUID
	ExpiresAt sql.NullTime
	RevokedAt sql.NullTime
}

type GetUserRow

type GetUserRow struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Email     string
}

type InsertRefreshTokenParams

type InsertRefreshTokenParams struct {
	Token     string
	UserID    uuid.UUID
	ExpiresAt sql.NullTime
	RevokedAt sql.NullTime
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateBlogPost

func (q *Queries) CreateBlogPost(ctx context.Context, arg CreateBlogPostParams) (Blogpost, error)

func (*Queries) CreateUser

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

func (*Queries) DeleteAllUsers

func (q *Queries) DeleteAllUsers(ctx context.Context) error

func (*Queries) DeleteBlogPost

func (q *Queries) DeleteBlogPost(ctx context.Context, arg DeleteBlogPostParams) error

func (*Queries) GetAllBlogPosts

func (q *Queries) GetAllBlogPosts(ctx context.Context) ([]Blogpost, error)

func (*Queries) GetAllBlogPostsDesc

func (q *Queries) GetAllBlogPostsDesc(ctx context.Context) ([]Blogpost, error)

func (*Queries) GetBlogPost

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

func (*Queries) GetBlogPostsAsc

func (q *Queries) GetBlogPostsAsc(ctx context.Context, userID uuid.UUID) ([]Blogpost, error)

func (*Queries) GetBlogPostsDesc

func (q *Queries) GetBlogPostsDesc(ctx context.Context, userID uuid.UUID) ([]Blogpost, error)

func (*Queries) GetEncryptedPassword

func (q *Queries) GetEncryptedPassword(ctx context.Context, email string) (GetEncryptedPasswordRow, error)

func (*Queries) GetRefreshToken

func (q *Queries) GetRefreshToken(ctx context.Context, token string) (GetRefreshTokenRow, error)

func (*Queries) GetUser

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

func (*Queries) InsertRefreshToken

func (q *Queries) InsertRefreshToken(ctx context.Context, arg InsertRefreshTokenParams) (RefreshToken, error)

func (*Queries) RevokeRefreshToken

func (q *Queries) RevokeRefreshToken(ctx context.Context, arg RevokeRefreshTokenParams) error

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error

func (*Queries) UpgradeToChirpyRed

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

func (*Queries) WithTx

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

type RefreshToken

type RefreshToken struct {
	Token     string
	CreatedAt time.Time
	UpdatedAt time.Time
	UserID    uuid.UUID
	ExpiresAt sql.NullTime
	RevokedAt sql.NullTime
}

type RevokeRefreshTokenParams

type RevokeRefreshTokenParams struct {
	Token     string
	RevokedAt sql.NullTime
	UpdatedAt time.Time
}

type UpdateUserParams

type UpdateUserParams struct {
	ID             uuid.UUID
	Email          string
	HashedPassword string
}

type User

type User struct {
	ID             uuid.UUID
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Email          string
	HashedPassword string
	IsChirpyRed    sql.NullBool
}

Jump to

Keyboard shortcuts

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