models

package
v0.0.0-...-e15c6a7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoRecord = modelsError("no matching record found")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogPost

type BlogPost struct {
	ID            int       `json:"id"`
	Slug          string    `json:"slug"`
	Title         string    `json:"title"`
	Body          []byte    `json:"-"`
	ParsedBody    string    `json:"body"`
	Tags          []BlogTag `json:"tags,omitempty"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
	IsCodeSnippet bool      `json:"is_code_snippet"`
}

type BlogPostFeedEntry

type BlogPostFeedEntry struct {
	ID        int       `json:"id"`
	Slug      string    `json:"slug"`
	Title     string    `json:"title"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type BlogPostModel

type BlogPostModel struct {
	DB *pgxpool.Pool
}

func (*BlogPostModel) GetBySlug

func (m *BlogPostModel) GetBySlug(slug string) (BlogPost, error)

func (*BlogPostModel) GetFeedPosts

func (m *BlogPostModel) GetFeedPosts(onlyCodeSnippets bool) ([]BlogPostFeedEntry, error)

func (*BlogPostModel) GetPostTags

func (m *BlogPostModel) GetPostTags(id int) ([]BlogTag, error)

type BlogTag

type BlogTag struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type BlogTagModel

type BlogTagModel struct {
	DB *pgxpool.Pool
}

func (*BlogTagModel) GetAll

func (m *BlogTagModel) GetAll() ([]BlogTag, error)

Jump to

Keyboard shortcuts

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