jurisdiction

package
v0.0.0-...-2cbf9d5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package jurisdiction contains jurisdiction related CRUD functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is used when a specifij Jurisdiction is requested but does not exist.
	ErrNotFound = errors.New("not found")

	// ErrInvalidID occurs when an ID is not in a valid form.
	ErrInvalidID = errors.New("ID is not in its proper form")

	// ErrForbidden occurs when a user tries to do something that is forbidden to them according to our access control policies.
	ErrForbidden = errors.New("attempted action is not allowed")
)

Functions

This section is empty.

Types

type Info

type Info struct {
	Code        string `db:"code" json:"code"`
	GNID        int    `db:"gnid" json:"gnid"`
	CountryCode string `db:"country_code" json:"country_code"`
	Name        string `db:"name" json:"name"`
	Active      bool   `db:"active" json:"active"`
}

type Jurisdiction

type Jurisdiction struct {
	// contains filtered or unexported fields
}

Jurisdiction manages the set of API's for jurisdiction access.

func New

func New(log *log.Logger, db *sqlx.DB) Jurisdiction

New constructs a Jurisdiction for api access.

func (Jurisdiction) Query

func (j Jurisdiction) Query(ctx context.Context, traceID string, pageNumber int, rowsPerPage int) ([]Info, error)

Query retrieves a list of active jurisdictions from the database.

func (Jurisdiction) QueryByCode

func (j Jurisdiction) QueryByCode(ctx context.Context, traceID string, claims auth.Claims, jurisdictionCode string) (Info, error)

QueryByjurisdictionCode gets the specified jurisdiction from the database.

func (Jurisdiction) ToggleActive

func (j Jurisdiction) ToggleActive(ctx context.Context, traceID string, claims auth.Claims, jurisdictionCode string) error

ToggleActive activates a jurisdiction in the database.

Jump to

Keyboard shortcuts

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