categories

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The database table name for post categories.
	TableName = "post_categories"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Insert(postID int, catID *int) error
	Delete(postID int) error
	Exists(postID int) bool
}

Repository defines methods for post categories to interact with the database.

type Store

type Store struct {
	*config.Config
}

Store defines the data layer for post fields.

func New

func New(cfg *config.Config) *Store

New

Creates a new post fields store.

func (*Store) Delete

func (s *Store) Delete(postID int) error

Delete

Returns nil if the post category was successfully deleted. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.NOTFOUND if the post meta was not found.

func (*Store) Exists

func (s *Store) Exists(id int) bool

Exists

Returns a bool indicating if the post cateory exists by ID. Logs errors.INTERNAL if there was an error executing the query.

func (*Store) Insert

func (s *Store) Insert(postID int, catID *int) error

Insert

Checks to see if the post category record exists before updating or creating the new record.

Jump to

Keyboard shortcuts

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