Documentation
¶
Index ¶
- Variables
- type Address
- type Code
- type Coordinates
- type DefNoteKey
- type DefSourceKey
- type DefUnit
- type Email
- type Inbox
- type Item
- type ItemCode
- type Key
- type Meta
- type Name
- type Note
- type NoteKey
- type Notes
- type Party
- type Person
- type Registration
- type SourceKey
- type TaxIdentity
- type Telephone
- type Unit
Constants ¶
This section is empty.
Variables ¶
var ( // KeyPattern describes what should keys look like KeyPattern = `^[a-z0-9][a-z0-9-+]*[a-z0-9]$` // KeyValidationRegexp is used for key validation KeyValidationRegexp = regexp.MustCompile(KeyPattern) )
var NoteKeyDefinitions = []DefNoteKey{ { Key: NoteKeyGoods, Description: "Goods Description", UNTDID4451: "AAA", }, { Key: NoteKeyPayment, Description: "Terms of Payment", UNTDID4451: "PMT", }, { Key: NoteKeyLegal, Description: "Legal or regulatory information", UNTDID4451: "ABY", }, { Key: NoteKeyDangerousGoods, Description: "Dangerous goods additional information", UNTDID4451: "AAC", }, { Key: NoteKeyAck, Description: "Acknowledgement Description", UNTDID4451: "AAE", }, { Key: NoteKeyRate, Description: "Rate additional information", UNTDID4451: "AAF", }, { Key: NoteKeyReason, Description: "Reason", UNTDID4451: "ACD", }, { Key: NoteKeyDispute, Description: "Dispute", UNTDID4451: "ACE", }, { Key: NoteKeyCustomer, Description: "Customer remarks", UNTDID4451: "CUR", }, { Key: NoteKeyGlossary, Description: "Glossary", UNTDID4451: "ACZ", }, { Key: NoteKeyCustoms, Description: "Customs declaration information", UNTDID4451: "CUS", }, { Key: NoteKeyGeneral, Description: "General information", UNTDID4451: "AAI", }, { Key: NoteKeyHandling, Description: "Handling instructions", UNTDID4451: "HAN", }, { Key: NoteKeyPackaging, Description: "Packaging information", UNTDID4451: "PKG", }, { Key: NoteKeyLoading, Description: "Loading instructions", UNTDID4451: "LOI", }, { Key: NoteKeyPrice, Description: "Price conditions", UNTDID4451: "AAK", }, { Key: NoteKeyPriority, Description: "Priority information", UNTDID4451: "PRI", }, { Key: NoteKeyRegulatory, Description: "Regulatory information", UNTDID4451: "REG", }, { Key: NoteKeySafety, Description: "Safety instructions", UNTDID4451: "SAF", }, { Key: NoteKeyShipLine, Description: "Ship line", UNTDID4451: "SLR", }, { Key: NoteKeySupplier, Description: "Supplier remarks", UNTDID4451: "SUR", }, { Key: NoteKeyTransport, Description: "Transportation information", UNTDID4451: "TRA", }, { Key: NoteKeyDelivery, Description: "Delivery information", UNTDID4451: "DEL", }, { Key: NoteKeyQuarantine, Description: "Quarantine information", UNTDID4451: "QIN", }, { Key: NoteKeyTax, Description: "Tax declaration", UNTDID4451: "TXD", }, }
NoteKeyDefinitions provides a map of Note Keys to their definitions including a description and UNTDID code.
var SourceKeyDefinitions = []DefSourceKey{ { Key: SourceKeyTaxAgency, Description: "Sourced directly from a tax agency", }, { Key: SourceKeyPassport, Description: "A passport document", }, { Key: SourceKeyNational, Description: "National ID Card or similar", }, { Key: SourceKeyPermit, Description: "Residential or similar permit", }, { Key: SourceKeyOther, Description: "An other type of source not listed", }, }
SourceKeyDefinitions lists all the keys with their descriptions
var UnitDefinitions = []DefUnit{ {UnitPiece, "Pieces (default)", "H87"}, {UnitGram, "Metric grams", "GRM"}, {UnitKilogram, "Metric kilograms", "KGM"}, {UnitMetricTon, "Metric tons", "TNE"}, {UnitMillimetre, "Milimetres", "MMT"}, {UnitCentimetre, "Centimetres", "CMT"}, {UnitMetre, "Metres", "MTR"}, {UnitKilometre, "Kilometers", "KMT"}, {UnitInch, "Inches", "INH"}, {UnitFoot, "Feet", "FOT"}, {UnitSquareMetre, "Square metres", "MTK"}, {UnitCubicMetre, "Cubic metres", "MTQ"}, {UnitCentilitre, "Centilitres", "CLT"}, {UnitLitre, "Litres", "LTR"}, {UnitWatt, "Watts", "WTT"}, {UnitKilowatt, "Kilowatts", "KWT"}, {UnitKilowattHour, "Kilowatt Hours", "KWH"}, {UnitDay, "Days", "DAY"}, {UnitSecond, "Seconds", "SEC"}, {UnitHour, "Hours", "HUR"}, {UnitMinute, "Minutes", "MIN"}, {UnitBag, "Bags", "XBG"}, {UnitBox, "Boxes", "XBX"}, {UnitBin, "Bins", "XBI"}, {UnitCan, "Cans", "XCA"}, {UnitTub, "Tubs", "XTB"}, {UnitCase, "Cases", "XCS"}, {UnitTray, "Trays", "XDS"}, {UnitPortion, "Portions", ""}, {UnitDozen, "Dozens", ""}, {UnitRoll, "Rolls", "XRO"}, {UnitCarton, "Cartons", "XCT"}, {UnitCylinder, "Cylinders", "XCY"}, {UnitBarrel, "Barrels", "XBA"}, {UnitJerrican, "Jerricans", "XJY"}, {UnitCarboy, "Carboys", "XCO"}, {UnitDemijohn, "Demijohn", "XDJ"}, {UnitBottle, "Bottles", "XBO"}, {UnitSixPack, "Six Packs", ""}, {UnitCanister, "Canisters", "XCI"}, {UnitPackage, "Packages", "XPK"}, {UnitBunch, "Bunches", "XBH"}, {UnitTetraBrik, "Tetra-Briks", ""}, {UnitPallet, "Pallets", "XPX"}, {UnitReel, "Reels", "XRL"}, {UnitSack, "Sacks", "XSA"}, {UnitSheet, "Sheets", "XST"}, {UnitEnvelope, "Envelopes", "XEN"}, }
UnitDefinitions describes each of the unit constants. Order is important.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // Internal ID used to identify the party inside a document. UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // Useful identifier, such as home, work, etc. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Box number or code for the post office box located at the address. PostOfficeBox string `json:"po_box,omitempty" jsonschema:"title=Post Office Box"` // House or building number in the street. Number string `json:"num,omitempty" jsonschema:"title=Number"` // Floor number within the building. Floor string `json:"floor,omitempty" jsonschema:"title=Floor"` // Block number within the building. Block string `json:"block,omitempty" jsonschema:"title=Block"` // Door number within the building. Door string `json:"door,omitempty" jsonschema:"title=Door"` // First line of street. Street string `json:"street,omitempty" jsonschema:"title=Street"` // Additional street address details. StreetExtra string `json:"street_extra,omitempty" jsonschema:"title=Extended Street"` // The village, town, district, or city. Locality string `json:"locality" jsonschema:"title=Locality"` // Province, County, or State. Region string `json:"region" jsonschema:"title=Region"` // Post or ZIP code. Code string `json:"code,omitempty" jsonschema:"title=Code"` // ISO country code. Country l10n.CountryCode `json:"country,omitempty" jsonschema:"title=Country"` // When the postal address is not sufficient, coordinates help locate the address more precisely. Coordinates *Coordinates `json:"coords,omitempty" jsonschema:"title=Coordinates"` // Any additional semi-structure details about the address. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Address defines a globally acceptable set of attributes that describes a postal or fiscal address. Attribute names loosly based on the xCard file format.
type Code ¶ added in v0.27.0
type Code string
Code represents a string used to uniquely identify the data we're looking at. We use "code" instead of "id", to reenforce the fact that codes should be more easily set and used by humans within definitions than IDs or UUIDs. Codes are standardised so that when validated they must contain between 2 and 6 inclusive upper-case letters or numbers.
const CodeEmpty Code = ""
CodeEmpty is used when no code is defined.
func (Code) In ¶ added in v0.27.0
In returns true if the code's value matches one of those in the provided list.
func (Code) JSONSchema ¶ added in v0.27.0
func (Code) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Coordinates ¶
type Coordinates struct { // Decimal latitude coordinate. Latitude float64 `json:"lat,omitempty" jsonschema:"title=Latitude"` // Decimal longitude coordinate. Longitude float64 `json:"lon,omitempty" jsonschema:"title=Longitude"` // Text coordinates compose of three words. W3W string `json:"w3w,omitempty" jsonschema:"title=What 3 Words"` // Single string coordinate based on geohash standard. Geohash string `json:"geohash,omitempty" jsonschema:"title=Geohash"` }
Coordinates describes an exact geographical location in the world. We provide support for a set of different options beyond regular latitude and longitude.
type DefNoteKey ¶ added in v0.29.0
type DefNoteKey struct { // Key to match against Key NoteKey `json:"key" jsonschema:"title=Key"` // Description of the Note Key Description string `json:"description" jsonschema:"title=Description"` // UNTDID 4451 code UNTDID4451 Code `json:"untdid4451" jsonschema:"title=UNTDID4451 Code"` }
DefNoteKey holds a note key definition
type DefSourceKey ¶ added in v0.29.0
type DefSourceKey struct { Key SourceKey `json:"key" jsonschema:"title=Key"` Description string `json:"description" jsonschema:"title=Description"` }
DefSourceKey defines the details we have regarding a document source key.
type DefUnit ¶ added in v0.29.0
type DefUnit struct { // Key for the Unit Unit Unit `json:"unit" jsonschema:"title=Unit"` // Description of the unit Description string `json:"description" jsonschema:"title=Description"` // Standard UN/ECE code UNECE Code `json:"unece" jsonschema:"title=UN/ECE Unit Code"` }
DefUnit serves to define unit keys.
type Email ¶
type Email struct { // Unique identity code UUID *uuid.UUID `json:"uuid,omitempty"` // Identifier for the email. Label string `json:"label,omitempty" jsonschema:"title=Label"` // Electronic mailing address. Address string `json:"addr" jsonschema:"title=Address"` // Additional fields. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Email describes the electronic mailing details.
type Inbox ¶ added in v0.26.0
type Inbox struct { // Unique ID. Useful if inbox is stored in a database. UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // Type of inbox being defined. Key Key `json:"key" jsonschema:"title=Key"` // Role assigned to this inbox that may be relevant for the consumer. Role Key `json:"role,omitempty" jsonschema:"title=Role"` // Human name for the inbox. Name string `json:"name,omitempty" jsonschema:"title=Name"` // Actual Code or ID that identifies the Inbox. Code string `json:"code"` }
Inbox is used to store data about a connection with a service that is responsible for potentially receiving copies of GOBL envelopes or other document formats defined locally.
type Item ¶
type Item struct { // Unique identify of this item independent of the Supplier IDs UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // Primary reference code that identifies this item. Additional codes can be provided in the 'codes' field. Ref string `json:"ref,omitempty" jsonschema:"title=Ref"` // Brief name of the item Name string `json:"name"` // Detailed description Description string `json:"desc,omitempty"` // Currency used for the item's price. Currency string `json:"currency,omitempty" jsonschema:"title=Currency"` // Base price of a single unit to be sold. Price num.Amount `json:"price" jsonschema:"title=Price"` // Unit of measure. Unit Unit `json:"unit,omitempty" jsonschema:"title=Unit"` // List of additional codes, IDs, or SKUs which can be used to identify the item. The should be agreed upon between supplier and customer. Codes []*ItemCode `json:"codes,omitempty" jsonschema:"title=Codes"` // Country code of where this item was from originally. Origin l10n.CountryCode `json:"origin,omitempty" jsonschema:"title=Country of Origin"` // Additional meta information that may be useful Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Item is used to describe a single product or service. Minimal usage implies just adding a name and price, more complete usage consists of adding descriptions, supplier IDs, SKUs, dimensions, etc.
A set of additional code, ID, or SKU can be included in the `codes` property. Each `ItemCode` can be defined with an optional type agreed upon between the supplier and customer. For general purpose use, the Item's `Ref` property is much easier to use.
We recommend setting prices with the item's "net" value, without tax, unless the document you're building supports the `price_includes_tax` option included in the `bill.Invoice` definition for example.
type ItemCode ¶ added in v0.1.0
type ItemCode struct { // Local or human reference for the type of code the value // represents. Label string `json:"label,omitempty" jsonschema:"title=Label"` // The item code's value. Value string `json:"value" jsonschema:"title=Value"` }
ItemCode contains a value and optional label property that means additional codes can be added to an item.
type Key ¶ added in v0.27.0
type Key string
Key is used to define an ID or code that more closely represents a human name. The objective is to make it easier to define constants that can be re-used more easily.
const KeyEmpty Key = ""
KeyEmpty is used when no key is available.
func (Key) In ¶ added in v0.28.2
In returns true if the key's value matches one of those in the provided list.
func (Key) JSONSchema ¶ added in v0.27.0
func (Key) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Meta ¶
Meta defines a structure for data about the data being defined. Typically would be used for adding additional IDs or specifications not already defined or required by the base structure.
GOBL is focussed on ensuring the recipient has everything they need, as such, meta should only be used for data that may be used by intermediary conversion processes that should not be needed by the end-user.
We need to always use strings for values so that meta-data is easy to convert into other formats, such as protobuf which has strict type requirements.
type Name ¶
type Name struct { // Unique identity code UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // What the person would like to be called Alias string `json:"alias,omitempty" jsonschema:"title=Alias"` // Additional prefix to add to name, like Mrs. or Mr. Prefix string `json:"prefix,omitempty" jsonschema:"title=Prefix"` // Person's given or first name Given string `json:"given" jsonschema:"title=Given"` // Middle names or initials Middle string `json:"middle,omitempty" jsonschema:"title=Middle"` // Second or Family name. Surname string `json:"surname" jsonschema:"title=Surname"` // Additional second of family name. Surname2 string `json:"surname2,omitempty" jsonschema:"title=Second Surname"` // Titles to include after the name. Suffix string `json:"suffix,omitempty" jsonschema:"title=Suffix"` // Any additional useful data. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Name represents what a human is called. This is a complex subject, see this w3 article for some insights: https://www.w3.org/International/questions/qa-personal-names
type Note ¶ added in v0.13.0
type Note struct { // Key specifying subject of the text Key NoteKey `json:"key,omitempty" jsonschema:"title=Key"` // Code used for additional data that may be required to identify the note. Code string `json:"code,omitempty" jsonschema:"title=Code"` // Source of this note, especially useful when auto-generated. Src string `json:"src,omitempty" jsonschema:"title=Source"` // The contents of the note Text string `json:"text" jsonschema:"title=Text"` }
Note represents a free text of additional information that may be added to a document.
func (*Note) UNTDID4451 ¶ added in v0.28.1
UNTDID4451 provides the note's UNTDID 4451 equivalent value. If not available, returns CodeEmpty.
type NoteKey ¶ added in v0.20.0
type NoteKey Key
NoteKey is used to describe the key used for identifying the type of note.
const ( // Goods Description NoteKeyGoods NoteKey = "goods" // Terms of Payment NoteKeyPayment NoteKey = "payment" // Legal or regulatory information NoteKeyLegal NoteKey = "legal" // Dangerous goods additional information NoteKeyDangerousGoods NoteKey = "dangerous-goods" // Acknowledgement Description NoteKeyAck NoteKey = "ack" // Rate additional information NoteKeyRate NoteKey = "rate" // Reason NoteKeyReason NoteKey = "reason" // Dispute NoteKeyDispute NoteKey = "dispute" // Customer remarks NoteKeyCustomer NoteKey = "customer" // Glossary NoteKeyGlossary NoteKey = "glossary" // Customs declaration information NoteKeyCustoms NoteKey = "customs" // General information NoteKeyGeneral NoteKey = "general" // Handling instructions NoteKeyHandling NoteKey = "handling" // Packaging information NoteKeyPackaging NoteKey = "packaging" // Loading instructions NoteKeyLoading NoteKey = "loading" // Price conditions NoteKeyPrice NoteKey = "price" // Priority information NoteKeyPriority NoteKey = "priority" // Regulatory information NoteKeyRegulatory NoteKey = "regulatory" // Safety Instructions NoteKeySafety NoteKey = "safety" // Ship Line NoteKeyShipLine NoteKey = "ship-line" // Supplier remarks NoteKeySupplier NoteKey = "supplier" // Transportation information NoteKeyTransport NoteKey = "transport" // Delivery Information NoteKeyDelivery NoteKey = "delivery" // Quarantine Information NoteKeyQuarantine NoteKey = "quarantine" // Tax declaration NoteKeyTax NoteKey = "tax" )
Predefined list of supported note keys based on the UNTDID 4451 list of text subject qualifiers. We've picked the ones which we think are most useful, but if you require an additional code, please send a pull request.
func (NoteKey) JSONSchema ¶ added in v0.29.0
func (k NoteKey) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type Party ¶
type Party struct { // Internal ID used to identify the party inside a document. ID string `json:"id,omitempty" jsonschema:"title=ID"` // Unique identity code UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // The entity's legal ID code used for tax purposes. They may have other numbers, but we're only interested in those valid for tax purposes. TaxID *TaxIdentity `json:"tax_id,omitempty" jsonschema:"title=Tax Identity"` // Legal name or representation of the organization. Name string `json:"name" jsonschema:"title=Name"` // Alternate short name. Alias string `json:"alias,omitempty" jsonschema:"title=Alias"` // Details of physical people who represent the party. People []*Person `json:"people,omitempty" jsonschema:"title=People"` // Digital inboxes used for forwarding electronic versions of documents Inboxes []*Inbox `json:"inboxes,omitempty" jsonschema:"title=Inboxes"` // Regular post addresses for where information should be sent if needed. Addresses []*Address `json:"addresses,omitempty" jsonschema:"title=Postal Addresses"` // Electronic mail addresses Emails []*Email `json:"emails,omitempty" jsonschema:"title=Email Addresses"` // Regular telephone numbers Telephones []*Telephone `json:"telephones,omitempty" jsonschema:"title=Telephone Numbers"` // Additional registration details about the company that may need to be included in a document. Registration *Registration `json:"registration,omitempty" jsonschema:"title=Registration"` // Any additional semi-structured information that does not fit into the rest of the party. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Party represents a person or business entity.
type Person ¶
type Person struct { // Internal ID used to identify the person inside a document. ID string `json:"id,omitempty" jsonschema:"title=ID"` // Unique identity code UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // Complete details on the name of the person Name Name `json:"name" jsonschema:"title=Name"` // What they do within an organization Role string `json:"role,omitempty" jsonschema:"title=Role"` // Electronic mail addresses that belong to the person. Emails []*Email `json:"emails,omitempty" jsonschema:"title=Email Addresses"` // Regular phone or mobile numbers Telephones []*Telephone `json:"telephones,omitempty" jsonschema:"title=Telephone Numbers"` // Data about the data. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
Person represents a human, and how to contact them electronically.
type Registration ¶ added in v0.1.0
type Registration struct { UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` Office string `json:"office,omitempty" jsonschema:"title=Office"` Book string `json:"book,omitempty" jsonschema:"title=Book"` Volume string `json:"volume,omitempty" jsonschema:"title=Volume"` Sheet string `json:"sheet,omitempty" jsonschema:"title=Sheet"` Section string `json:"section,omitempty" jsonschema:"title=Section"` Page string `json:"page,omitempty" jsonschema:"title=Page"` Entry string `json:"entry,omitempty" jsonschema:"title=Entry"` }
Registration is used in countries that require additional information to be associated with a company usually related to a specific registration office. The definition found here is based on the details required for spain. If your country requires additional fields, please let us know.
type SourceKey ¶ added in v0.29.0
type SourceKey Key
SourceKey is used to identify different sources of tax identities that may be required by some regions.
const ( // Directly from tax Agency SourceKeyTaxAgency SourceKey = "tax-agency" // A passport document SourceKeyPassport SourceKey = "passport" // National ID Card or similar SourceKeyNational SourceKey = "national" // Residential permit SourceKeyPermit SourceKey = "permit" // Something else SourceKeyOther SourceKey = "other" )
Main Source Key definitions.
func (SourceKey) JSONSchema ¶ added in v0.29.0
func (k SourceKey) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.
type TaxIdentity ¶ added in v0.20.0
type TaxIdentity struct { // Unique universal identity code. UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // ISO country code for Where the tax identity was issued. Country l10n.CountryCode `json:"country" jsonschema:"title=Country Code"` // Where inside a country the Tax ID was issued, if required. Locality l10n.Code `json:"locality,omitempty" jsonschema:"title=Locality Code"` // What is the source document of this tax identity. Source SourceKey `json:"source,omitempty" jsonschema:"title=Source Key"` // Tax identity Code Code string `json:"code,omitempty" jsonschema:"title=Code"` // Additional details that may be required. Meta Meta `json:"meta,omitempty" jsonschema:"title=Meta"` }
TaxIdentity stores the details required to identify an entity for tax purposes.
func (*TaxIdentity) Validate ¶ added in v0.20.0
func (id *TaxIdentity) Validate() error
Validate checks to ensure the tax ID contains all the required fields. The check the value itself is in the expected format according to the country, you'll need to use the region packages directly. See also the region `ValidateTaxID` method.
type Telephone ¶
type Telephone struct { // Unique identity code UUID *uuid.UUID `json:"uuid,omitempty" jsonschema:"title=UUID"` // Identifier for this number. Label string `json:"label,omitempty" jsonschema:"title=Label"` // The number to be dialed in ITU E.164 international format. Number string `json:"num" jsonschema:"title=Number"` }
Telephone describes what is expected for a telephone number.
type Unit ¶ added in v0.20.0
type Unit string
Unit is used to represent standard unit types.
const ( // Default empty value is a "piece" UnitPiece Unit = `` // Measurement units UnitGram Unit = `g` UnitKilogram Unit = `kg` UnitMetricTon Unit = `t` UnitMillimetre Unit = `mm` UnitCentimetre Unit = `cm` UnitMetre Unit = `m` UnitKilometre Unit = `km` UnitInch Unit = `in` UnitFoot Unit = `ft` UnitSquareMetre Unit = `m2` UnitCubicMetre Unit = `m3` UnitCentilitre Unit = `cl` UnitLitre Unit = `l` UnitWatt Unit = `w` UnitKilowatt Unit = `kw` UnitKilowattHour Unit = `kwh` UnitDay Unit = `day` UnitSecond Unit = `s` UnitHour Unit = `h` UnitMinute Unit = `min` // Presentation Unit Codes UnitBag Unit = `bag` UnitBox Unit = `box` UnitBin Unit = `bin` UnitCan Unit = `can` UnitTub Unit = `tub` UnitCase Unit = `case` UnitTray Unit = `tray` UnitPortion Unit = `portion` // non-standard (src: ES) UnitDozen Unit = `dozen` // non-standard (src: ES) UnitRoll Unit = `roll` UnitCarton Unit = `carton` UnitCylinder Unit = `cylinder` UnitBarrel Unit = `barrel` UnitJerrican Unit = `jerrican` UnitCarboy Unit = `carboy` UnitDemijohn Unit = `demijohn` UnitBottle Unit = `bottle` UnitSixPack Unit = `6pack` // non-standard (src: ES) UnitCanister Unit = `canister` UnitPackage Unit = `pkg` UnitBunch Unit = `bunch` UnitTetraBrik Unit = `tetrabrik` // non-standard (src: ES) UnitPallet Unit = `pallet` UnitReel Unit = `reel` UnitSack Unit = `sack` UnitSheet Unit = `sheet` UnitEnvelope Unit = `envelope` )
Set of common units based on UN/ECE recommendation 20 and 21. Some local formats may define additional non-standard codes which may be added. There are so many different unit codes in the world, that it's impractical to try and define them all, this is thus a selection of which we think are the most useful.
func (Unit) JSONSchema ¶ added in v0.29.0
func (u Unit) JSONSchema() *jsonschema.Schema
JSONSchema provides a representation of the struct for usage in Schema.