authors

package
v0.0.0-...-9f86afd Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const QueryGetAll = `
SELECT id, full_name
FROM authors 
WHERE 
	id > $1 AND
	name LIKE '%' || $2 || '%'
ORDER BY id
FETCH NEXT $3 ROWS ONLY;`
View Source
const QueryGetDetail = `
SELECT full_name
FROM authors 
WHERE id=$1;`
View Source
const QueryInsert = `
INSERT INTO 
	authors(full_name) 
	VALUES($1) 
RETURNING id;`

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CursorSecret string `koanf:"cursor_secret"`
	Limit        struct {
		Min int `koanf:"min"`
		Max int `koanf:"max"`
	} `koanf:"limit"`
}

func (Config) Default

func (c Config) Default() *Config

type Repository

type Repository interface {
	// insert an author
	Insert(context.Context, *models.Author) error

	// get author detail
	GetById(ctx context.Context, id uint64) (*models.Author, error)

	// search + pagination (no detail)
	GetAll(ctx context.Context, encryptedCursor, search string, limit int) ([]models.Author, string, error)
}

func New

func New(logger *zap.Logger, config *Config, rdbms rdbms.RDBMS) Repository

Jump to

Keyboard shortcuts

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