meta

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The database table name for meta options.
	TableName = "post_options"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Insert(id int, p domain.PostOptions) error
	Delete(postID int) error
	Exists(id int) bool
}

Repository defines methods for meta options to interact with the database.

type Store

type Store struct {
	*config.Config
}

Store defines the data layer for meta.

func New

func New(cfg *config.Config) *Store

New

Creates a new meta store.

func (*Store) Delete

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

Delete

Returns nil if the post meta 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 option exists by ID. Logs errors.INTERNAL if there was an error executing the query.

func (*Store) Insert

func (s *Store) Insert(id int, p domain.PostOptions) error

Insert

Checks to see if the post options 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