postgres

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apikey

type Apikey struct {
	ID        int32
	PublicID  string
	Name      string
	Key       string
	Revoked   bool
	RevokedAt pgtype.Timestamp
	CreatedAt pgtype.Timestamp
	UpdatedAt pgtype.Timestamp
}

type Chikito added in v1.3.0

type Chikito struct {
	ID          int32
	PublicID    string
	Url         string
	Description string
	CreatedAt   pgtype.Timestamp
	UpdatedAt   pgtype.Timestamp
}

type CreateAPIKeyParams

type CreateAPIKeyParams struct {
	PublicID string
	Name     string
	Key      string
}

type CreateChikitoParams added in v1.3.0

type CreateChikitoParams struct {
	PublicID    string
	Url         string
	Description string
}

type CreatePostParams

type CreatePostParams struct {
	PublicID    string
	Title       string
	Author      string
	Slug        string
	Description string
	Content     string
}

type CreateProjectParams

type CreateProjectParams struct {
	PublicID     string
	Name         string
	Description  string
	Tags         []string
	ThumbnailUrl string
	WebsiteUrl   string
	Live         bool
	PostID       pgtype.Int4
}

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 NullPostStatus

type NullPostStatus struct {
	PostStatus PostStatus
	Valid      bool // Valid is true if PostStatus is not NULL
}

func (*NullPostStatus) Scan

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

Scan implements the Scanner interface.

func (NullPostStatus) Value

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

Value implements the driver Valuer interface.

type Post

type Post struct {
	ID          int32
	PublicID    string
	Title       string
	Author      string
	Content     string
	Description string
	Slug        string
	Status      PostStatus
	PublishedAt pgtype.Timestamp
	CreatedAt   pgtype.Timestamp
	UpdatedAt   pgtype.Timestamp
}

type PostStatus

type PostStatus string
const (
	PostStatusDraft     PostStatus = "draft"
	PostStatusPublished PostStatus = "published"
	PostStatusArchived  PostStatus = "archived"
)

func (*PostStatus) Scan

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

type Project

type Project struct {
	ID           int32
	PublicID     string
	Name         string
	Description  string
	Tags         []string
	ThumbnailUrl string
	WebsiteUrl   string
	Live         bool
	CreatedAt    pgtype.Timestamp
	UpdatedAt    pgtype.Timestamp
	PostID       pgtype.Int4
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAPIKey

func (q *Queries) CreateAPIKey(ctx context.Context, arg CreateAPIKeyParams) (Apikey, error)

func (*Queries) CreateChikito added in v1.3.0

func (q *Queries) CreateChikito(ctx context.Context, arg CreateChikitoParams) (Chikito, error)

func (*Queries) CreatePost

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

func (*Queries) CreateProject

func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)

func (*Queries) GetAPIKeyByValue added in v1.2.0

func (q *Queries) GetAPIKeyByValue(ctx context.Context, key string) (Apikey, error)

func (*Queries) GetChikito added in v1.3.0

func (q *Queries) GetChikito(ctx context.Context, publicID string) (Chikito, error)

func (*Queries) GetPost

func (q *Queries) GetPost(ctx context.Context, publicID string) (Post, error)

func (*Queries) GetPostBySlug

func (q *Queries) GetPostBySlug(ctx context.Context, slug string) (Post, error)

func (*Queries) GetPosts

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

func (*Queries) GetProject

func (q *Queries) GetProject(ctx context.Context, publicID string) (Project, error)

func (*Queries) GetProjects

func (q *Queries) GetProjects(ctx context.Context) ([]Project, error)

func (*Queries) RevokeAPIKey

func (q *Queries) RevokeAPIKey(ctx context.Context, publicID string) error

func (*Queries) UpdatePost

func (q *Queries) UpdatePost(ctx context.Context, arg UpdatePostParams) (Post, error)

func (*Queries) WithTx

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

type UpdatePostParams

type UpdatePostParams struct {
	Title       string
	Author      string
	Slug        string
	Description string
	Content     string
	Status      PostStatus
	PublishedAt pgtype.Timestamp
	ID          int32
}

Jump to

Keyboard shortcuts

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