query

package
v0.0.0-...-4f50f5e Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddUserParams

type AddUserParams struct {
	Name     string   `db:"name"`
	Email    string   `db:"email"`
	Password string   `db:"password"`
	Role     UserRole `db:"role"`
}

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 Post

type Post struct {
	ID          int32          `db:"id"`
	Title       string         `db:"title"`
	Slug        string         `db:"slug"`
	Summary     string         `db:"summary"`
	FeatureImg  sql.NullString `db:"feature_img"`
	Content     string         `db:"content"`
	Status      string         `db:"status"`
	Likes       int64          `db:"likes"`
	Views       int64          `db:"views"`
	PublishedAt sql.NullTime   `db:"published_at"`
	CreatedAt   time.Time      `db:"created_at"`
	UpdatedAt   time.Time      `db:"updated_at"`
}

type PostAuthor

type PostAuthor struct {
	UserID int32 `db:"user_id"`
	PostID int32 `db:"post_id"`
}

type PostStatus

type PostStatus string
const (
	PostStatusDraft   PostStatus = "draft"
	PostStatusPublish PostStatus = "publish"
	PostStatusArchive PostStatus = "archive"
)

func (*PostStatus) Scan

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

type PostTag

type PostTag struct {
	PostID int32 `db:"post_id"`
	TagID  int32 `db:"tag_id"`
}

type PostTopic

type PostTopic struct {
	TopicID int32 `db:"topic_id"`
	PostID  int32 `db:"post_id"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddUser

func (q *Queries) AddUser(ctx context.Context, arg AddUserParams) (User, error)

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, id int32) error

func (*Queries) FetchAllUsers

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

func (*Queries) FetchUser

func (q *Queries) FetchUser(ctx context.Context, id int32) (User, error)

func (*Queries) UpdateUser

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

func (*Queries) UpdateUserPassword

func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) (User, error)

func (*Queries) WithTx

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

type Setting

type Setting struct {
	ID        int32     `db:"id"`
	SiteName  string    `db:"site_name"`
	Favicon   string    `db:"favicon"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type Subscriber

type Subscriber struct {
	ID            int32     `db:"id"`
	Email         string    `db:"email"`
	EmailVerified bool      `db:"email_verified"`
	Unsubscribed  bool      `db:"unsubscribed"`
	CreatedAt     time.Time `db:"created_at"`
	UpdatedAt     time.Time `db:"updated_at"`
}

type Tag

type Tag struct {
	ID        int32     `db:"id"`
	Name      string    `db:"name"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

type Topic

type Topic struct {
	ID        int32         `db:"id"`
	Name      string        `db:"name"`
	ParentID  sql.NullInt32 `db:"parent_id"`
	CreatedAt time.Time     `db:"created_at"`
	UpdatedAt time.Time     `db:"updated_at"`
}

type UpdateUserParams

type UpdateUserParams struct {
	Name          string   `db:"name"`
	Email         string   `db:"email"`
	Role          UserRole `db:"role"`
	EmailVerified bool     `db:"email_verified"`
	ID            int32    `db:"id"`
}

type UpdateUserPasswordParams

type UpdateUserPasswordParams struct {
	Password string `db:"password"`
	ID       int32  `db:"id"`
}

type User

type User struct {
	ID            int32     `db:"id"`
	Name          string    `db:"name"`
	Email         string    `db:"email"`
	Password      string    `db:"password"`
	Role          UserRole  `db:"role"`
	EmailVerified bool      `db:"email_verified"`
	CreatedAt     time.Time `db:"created_at"`
	UpdatedAt     time.Time `db:"updated_at"`
}

type UserRole

type UserRole string
const (
	UserRoleOwner       UserRole = "owner"
	UserRoleAdmin       UserRole = "admin"
	UserRoleEditor      UserRole = "editor"
	UserRoleAuthor      UserRole = "author"
	UserRoleContributor UserRole = "contributor"
)

func (*UserRole) Scan

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

Jump to

Keyboard shortcuts

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