postgres

package
v0.0.0-...-b4653eb Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 12 Imported by: 0

README

postgres

How to generate a new version

# cd into this package
$ cd services/content-api/storage/postgres
$ go generate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNullTime

func NewNullTime(t *time.Time) sql.NullTime

func NewTimeFromNullTime

func NewTimeFromNullTime(t sql.NullTime) *time.Time

Types

type CreatePageContentParams

type CreatePageContentParams struct {
	ID     uuid.UUID
	PageID uuid.UUID
	Title  string
	Html   string
}

type CreatePageParams

type CreatePageParams struct {
	ID               uuid.UUID
	Namespace        string
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
}

type CreatePostContentParams

type CreatePostContentParams struct {
	ID      uuid.UUID
	PostID  uuid.UUID
	Title   string
	Content string
}

type CreatePostParams

type CreatePostParams struct {
	ID               uuid.UUID
	Namespace        string
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
}

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 FindPageBySlugParams

type FindPageBySlugParams struct {
	Namespace string
	Slug      string
}

type FindPageBySlugRow

type FindPageBySlugRow struct {
	ID          uuid.UUID
	Namespace   string
	Slug        string
	Title       string
	Html        string
	PublishedAt sql.NullTime
}

type FindPostBySlugParams

type FindPostBySlugParams struct {
	Namespace string
	Slug      string
}

type FindPostBySlugRow

type FindPostBySlugRow struct {
	ID          uuid.UUID
	Namespace   string
	Slug        string
	Title       string
	Content     string
	PublishedAt sql.NullTime
}

type ListPagesParams

type ListPagesParams struct {
	Namespace     string
	IncludeDrafts bool
	StartFrom     int32
	PageSize      int32
}

type ListPagesRow

type ListPagesRow struct {
	ID          uuid.UUID
	Namespace   string
	Slug        string
	Title       string
	PublishedAt sql.NullTime
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type ListPostsParams

type ListPostsParams struct {
	IncludeDrafts bool
	Namespace     string
	StartFrom     int32
	PageSize      int32
}

type ListPostsRow

type ListPostsRow struct {
	ID          uuid.UUID
	Namespace   string
	Slug        string
	Title       string
	Content     string
	PublishedAt sql.NullTime
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type Page

type Page struct {
	ID               uuid.UUID
	Namespace        string
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        sql.NullTime
}

type PageRepository

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

func NewPageRepository

func NewPageRepository(psql *sql.DB) *PageRepository

func (*PageRepository) CreatePage

func (*PageRepository) FindBySlug

func (*PageRepository) ListPages

func (*PageRepository) UpdatePage

type PagesContent

type PagesContent struct {
	ID        uuid.UUID
	PageID    uuid.UUID
	Title     string
	Html      string
	CreatedAt time.Time
}

type PagesMetadataParams

type PagesMetadataParams struct {
	IncludeDrafts bool
	Namespace     string
}

type PagesMetadataRow

type PagesMetadataRow struct {
	TotalSize      int64
	DraftsIncluded bool
}

type Post

type Post struct {
	ID               uuid.UUID
	Namespace        string
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        sql.NullTime
}

type PostRepository

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

func NewPostRepository

func NewPostRepository(psql *sql.DB) *PostRepository

func (*PostRepository) CreatePost

func (*PostRepository) FindBySlug

func (*PostRepository) ListPosts

func (*PostRepository) UpdatePost

type PostsContent

type PostsContent struct {
	ID        uuid.UUID
	PostID    uuid.UUID
	Title     string
	Content   string
	CreatedAt time.Time
}

type PostsMetadataParams

type PostsMetadataParams struct {
	IncludeDrafts bool
	Namespace     string
}

type PostsMetadataRow

type PostsMetadataRow struct {
	TotalSize      int64
	DraftsIncluded bool
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreatePage

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

func (*Queries) CreatePageContent

func (q *Queries) CreatePageContent(ctx context.Context, arg CreatePageContentParams) (uuid.UUID, error)

func (*Queries) CreatePost

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

func (*Queries) CreatePostContent

func (q *Queries) CreatePostContent(ctx context.Context, arg CreatePostContentParams) (uuid.UUID, error)

func (*Queries) FindPageBySlug

func (q *Queries) FindPageBySlug(ctx context.Context, arg FindPageBySlugParams) (FindPageBySlugRow, error)

func (*Queries) FindPostBySlug

func (q *Queries) FindPostBySlug(ctx context.Context, arg FindPostBySlugParams) (FindPostBySlugRow, error)

func (*Queries) ListPages

func (q *Queries) ListPages(ctx context.Context, arg ListPagesParams) ([]ListPagesRow, error)

func (*Queries) ListPosts

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

func (*Queries) PagesMetadata

func (q *Queries) PagesMetadata(ctx context.Context, arg PagesMetadataParams) (PagesMetadataRow, error)

func (*Queries) PostsMetadata

func (q *Queries) PostsMetadata(ctx context.Context, arg PostsMetadataParams) (PostsMetadataRow, error)

func (*Queries) UpdatePage

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

func (*Queries) UpdatePost

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

func (*Queries) WithTx

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

type UpdatePageParams

type UpdatePageParams struct {
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
	ID               uuid.UUID
}

type UpdatePostParams

type UpdatePostParams struct {
	Slug             string
	CurrentContentID uuid.UUID
	PublishedAt      sql.NullTime
	ID               uuid.UUID
}

Jump to

Keyboard shortcuts

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