region

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code string

Code defines the code used to identify a region.

const (
	ES Code = "ES" // Spain
	GB Code = "GB" // Great Britain (not nothern ireland)
)

Defined region codes.

type Collection

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

Collection holds a set of regions.

func NewCollection

func NewCollection(regions ...Region) *Collection

NewCollection expects an array of regions, from which

func (*Collection) Codes

func (c *Collection) Codes() []Code

Codes provides a list of region codes contained in the collection.

func (*Collection) For

func (c *Collection) For(code Code) Region

For returns the region definition for the document or nil if the region code is invalid.

func (*Collection) List

func (c *Collection) List() map[Code]Region

List provides the list of regions and their definitions. Only really meant for exporting data.

type Region

type Region interface {
	// Taxes provides a region's tax definition
	Taxes() *tax.Region

	// Currency provides the regions default currency definition.
	Currency() *currency.Def

	// Code provides this regions official code.
	Code() Code

	// Validate determines the type of GOBL document provided and attempts
	// to check the contents for errors.
	Validate(obj interface{}) error
}

Region represents the methods we expect to be available from a region.

Jump to

Keyboard shortcuts

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