database

package
v0.0.0-...-39ba26b Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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 CreateOrUpdateUserParams

type CreateOrUpdateUserParams struct {
	Sub  string
	Name string
}

type CreatePostsParams

type CreatePostsParams struct {
	Sub     string
	Title   string
	Content pgtype.Text
}

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 GetPostDetailRow

type GetPostDetailRow struct {
	ID      int64
	UserID  pgtype.Int8
	Name    string
	Title   string
	Content pgtype.Text
	Created pgtype.Timestamptz
}

type ListPostsRow

type ListPostsRow struct {
	ID      int64
	UserID  pgtype.Int8
	Name    string
	Title   string
	Created pgtype.Timestamptz
}

type Post

type Post struct {
	ID      int64
	UserID  pgtype.Int8
	Title   string
	Content pgtype.Text
	Created pgtype.Timestamptz
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateOrUpdateUser

func (q *Queries) CreateOrUpdateUser(ctx context.Context, arg CreateOrUpdateUserParams) (User, error)

func (*Queries) CreatePosts

func (q *Queries) CreatePosts(ctx context.Context, arg CreatePostsParams) (Post, error)

func (*Queries) GetPostDetail

func (q *Queries) GetPostDetail(ctx context.Context, id int64) (GetPostDetailRow, error)

func (*Queries) ListPosts

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

func (*Queries) WithTx

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

type User

type User struct {
	ID   int64
	Sub  string
	Name string
}

Jump to

Keyboard shortcuts

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