languages

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, name 
FROM languages 
WHERE 
	id > $1 AND
	name LIKE '%' || $2 || '%'
ORDER BY id
FETCH NEXT $3 ROWS ONLY;`
View Source
const QueryGetDetail = `
SELECT name 
FROM languages 
WHERE id=$1;`
View Source
const QueryInsert = `
INSERT INTO 
	languages(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 a language
	Insert(context.Context, *models.Language) error

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

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

Jump to

Keyboard shortcuts

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