Documentation
¶
Overview ¶
Package internal is used for internal option configuration.
Index ¶
Constants ¶
const DateTimeSeparator = " · "
DateTimeSeparator is used to join the formatted date and time when rendering a cal.DateTime value.
Variables ¶
var CalFormatterISO = CalFormatter{ Date: "2006-01-02", Time: "15:04", Location: time.UTC, }
CalFormatterISO is the default formatter for dates and times based on the recommended ISO 8601 formatting.
Functions ¶
Types ¶
type CalFormatter ¶
type CalFormatter struct {
Date string // Golang date format for dates, e.g. `02/01/2006`
Time string // Golang time format for times, e.g. `15:04`
Location *time.Location
}
CalFormatter defines a simple date and time formatter. Date and time formats are configured independently; date-time values are rendered by composing the two with a separator.
type Document ¶ added in v0.68.0
type Document interface {
Extract() any
GetType() cbc.Key
GetSupplier() *org.Party
GetCustomer() *org.Party
GetIssueDate() cal.Date
GetSeries() cbc.Code
GetCode() cbc.Code
GetRegime() tax.Regime
GetCurrency() currency.Code
GetExt() tax.Extensions
GetPreceding() []*org.DocumentRef
}
Document is the interface to handle GOBL documents generically.
func DocumentFor ¶ added in v0.68.0
DocumentFor returns a Document interface for the given document.
func ExtractDocumentFrom ¶ added in v0.68.0
ExtractDocumentFrom returns a Document interface for the given envelope.
type Opts ¶
type Opts struct {
// Locale is the language code to use for rendering.
Locale i18n.Code
// Logo used instead of the document's logo.
Logo *org.Image
// Notes to add to the document footer instead of the notes included
// in the envelope.
Notes string
// NumFormatter is used to format numbers.
NumFormatter *num.Formatter
// CurrencyTemplate is used to format currency amounts with their units,
// and overrides those from the number formatter.
CurrencyTemplate string
// ThousandsSeparator overrides the thousands separator from the number formatter.
ThousandsSeparator string
// DecimalMark overrides the decimal mark from the number formatter.
DecimalMark string
// NegativeTemplate overrides the negative template from the number formatter.
NegativeTemplate string
// CalFormatter is used to format calendar dates and times.
CalFormatter *CalFormatter
// EmbedAssets when try ensures that all the stylesheet or script files
// are contained inside the HTML output. This is useful for PDF output
// or to avoid additional requests.
EmbedAssets bool
// Layout indicates the Layout used in te document
Layout layout.Code
// Void indicates if the document should be rendered as void
Void bool
// Sandbox indicates if the document should be rendered in sandbox mode
Sandbox bool
// Watermark indicates the watermark to use in the document
Watermark string
// Label indicates the label to use in the document
Label string
// AdjustmentMode indicates that invoice types credit-note and debit-note
// or similar should be rendered as adjustments to the original invoice, as
// required in certain jurisdictions.
AdjustmentMode bool
}
Opts defines configuration options used internally with the current document. Putting this amount of information inside a context is normally an anti-pattern in Go, but saves a huge amount of effort when writing components.