db

package
v0.0.0-...-72c0d7f Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 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 AddToShelfParams

type AddToShelfParams struct {
	OwnerID int64
	StoryID int64
}

type Choice

type Choice struct {
	PageID int64
	PathID int64
}

type CreateChoicesParams

type CreateChoicesParams struct {
	PageID int64
	PathID int64
}

type CreatePageParams

type CreatePageParams struct {
	Action string
	Author int64
	Body   string
}

type CreateStoryParams

type CreateStoryParams struct {
	Title       string
	Description sql.NullString
	Author      int64
}

type CreateUserParams

type CreateUserParams struct {
	Username     string
	PasswordHash string
	Email        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 GetFeaturedStoriesRow

type GetFeaturedStoriesRow struct {
	ID          int64
	Title       string
	Description sql.NullString
	HasImg      bool
	AuthorName  string
}

type GetOnShelfParams

type GetOnShelfParams struct {
	OwnerID int64
	StoryID int64
}

type GetShelfParams

type GetShelfParams struct {
	OwnerID int64
	Column2 interface{}
}

type GetShelfRow

type GetShelfRow struct {
	ID          int64
	Title       string
	Description sql.NullString
	HasImg      bool
	AuthorName  string
}

type GetStoryRow

type GetStoryRow struct {
	ID          int64
	Title       string
	Description sql.NullString
	FirstPageID sql.NullInt64
	HasImg      bool
	Author      int64
	AuthorName  string
}

type GetUserDetailsRow

type GetUserDetailsRow struct {
	ID           int64
	Username     string
	PasswordHash string
	HasImg       bool
	IsAdmin      bool
	Email        string
	StoryID      sql.NullInt64
	Title        sql.NullString
	Description  sql.NullString
	StoryHasImg  sql.NullBool
}

type ListChoicesRow

type ListChoicesRow struct {
	Action string
	PathID int64
}

type Page

type Page struct {
	ID     int64
	Author int64
	HasImg bool
	Action string
	Body   string
}

type Postgres

type Postgres struct {
	DB *sql.DB
}

func NewPostgres

func NewPostgres(host, port, user, password string) (*Postgres, error)

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddToShelf

func (q *Queries) AddToShelf(ctx context.Context, arg AddToShelfParams) error

func (*Queries) CreateChoices

func (q *Queries) CreateChoices(ctx context.Context, arg CreateChoicesParams) (Choice, error)

func (*Queries) CreatePage

func (q *Queries) CreatePage(ctx context.Context, arg CreatePageParams) (Page, error)

func (*Queries) CreateStory

func (q *Queries) CreateStory(ctx context.Context, arg CreateStoryParams) (Story, error)

func (*Queries) CreateUser

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

func (*Queries) DeletePage

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

func (*Queries) DeleteStory

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

func (*Queries) DeleteUser

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

func (*Queries) GetFeaturedStories

func (q *Queries) GetFeaturedStories(ctx context.Context) ([]GetFeaturedStoriesRow, error)

func (*Queries) GetOnShelf

func (q *Queries) GetOnShelf(ctx context.Context, arg GetOnShelfParams) (Shelf, error)

func (*Queries) GetPage

func (q *Queries) GetPage(ctx context.Context, id int64) (Page, error)

func (*Queries) GetShelf

func (q *Queries) GetShelf(ctx context.Context, arg GetShelfParams) ([]GetShelfRow, error)

func (*Queries) GetStory

func (q *Queries) GetStory(ctx context.Context, id int64) (GetStoryRow, error)

func (*Queries) GetStoryAuthor

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

func (*Queries) GetUserDetails

func (q *Queries) GetUserDetails(ctx context.Context, username string) ([]GetUserDetailsRow, error)

func (*Queries) GetUserWithEmail

func (q *Queries) GetUserWithEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserWithId

func (q *Queries) GetUserWithId(ctx context.Context, id int64) (User, error)

func (*Queries) GetUserWithUsername

func (q *Queries) GetUserWithUsername(ctx context.Context, username string) (User, error)

func (*Queries) ListChoices

func (q *Queries) ListChoices(ctx context.Context, pageID int64) ([]ListChoicesRow, error)

func (*Queries) RemoveFromShelf

func (q *Queries) RemoveFromShelf(ctx context.Context, arg RemoveFromShelfParams) error

func (*Queries) SearchStories

func (q *Queries) SearchStories(ctx context.Context, arg SearchStoriesParams) ([]SearchStoriesRow, error)

func (*Queries) SearchUsers

func (q *Queries) SearchUsers(ctx context.Context, arg SearchUsersParams) ([]User, error)

func (*Queries) SetAdmin

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

func (*Queries) SetImgPage

func (q *Queries) SetImgPage(ctx context.Context, arg SetImgPageParams) error

func (*Queries) SetImgStory

func (q *Queries) SetImgStory(ctx context.Context, arg SetImgStoryParams) error

func (*Queries) SetImgUser

func (q *Queries) SetImgUser(ctx context.Context, arg SetImgUserParams) error

func (*Queries) SetStoryAsFeatured

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

func (*Queries) UpdatePage

func (q *Queries) UpdatePage(ctx context.Context, arg UpdatePageParams) error

func (*Queries) UpdateStory

func (q *Queries) UpdateStory(ctx context.Context, arg UpdateStoryParams) error

func (*Queries) UpdateUser

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

func (*Queries) WithTx

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

type RemoveFromShelfParams

type RemoveFromShelfParams struct {
	OwnerID int64
	StoryID int64
}

type SearchStoriesParams

type SearchStoriesParams struct {
	Column1 sql.NullString
	Column2 interface{}
}

type SearchStoriesRow

type SearchStoriesRow struct {
	ID          int64
	Title       string
	Description sql.NullString
	HasImg      bool
	Featured    bool
	AuthorName  string
}

type SearchUsersParams

type SearchUsersParams struct {
	Column1 sql.NullString
	Column2 interface{}
}

type SetImgPageParams

type SetImgPageParams struct {
	ID     int64
	HasImg bool
}

type SetImgStoryParams

type SetImgStoryParams struct {
	ID     int64
	HasImg bool
}

type SetImgUserParams

type SetImgUserParams struct {
	ID     int64
	HasImg bool
}

type Shelf

type Shelf struct {
	OwnerID int64
	StoryID int64
}

type Story

type Story struct {
	ID          int64
	Title       string
	Description sql.NullString
	HasImg      bool
	Featured    bool
	Author      int64
	FirstPageID sql.NullInt64
}

type UpdatePageParams

type UpdatePageParams struct {
	ID             int64
	ActionDoUpdate bool
	Action         string
	BodyDoUpdate   bool
	Body           string
}

type UpdateStoryParams

type UpdateStoryParams struct {
	ID                  int64
	TitleDoUpdate       bool
	Title               string
	DescriptionDoUpdate bool
	Description         string
}

type UpdateUserParams

type UpdateUserParams struct {
	ID                   int64
	UsernameDoUpdate     bool
	Username             string
	PasswordHashDoUpdate bool
	PasswordHash         string
	EmailDoUpdate        bool
	Email                string
}

type User

type User struct {
	ID           int64
	Username     string
	PasswordHash string
	HasImg       bool
	IsAdmin      bool
	Email        string
}

Jump to

Keyboard shortcuts

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