Download pkg/currencyx/code.go from Leon4gr45/openmeter: direct link, hf CLI and curl.
- Browser
- Download file 495 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openmeter/resolve/main/pkg/currencyx/code.go
- Command line
-
hf download hf://spaces/Leon4gr45/openmeter/pkg/currencyx/code.go
-
curl -L -o code.go https://huggingface.co/spaces/Leon4gr45/openmeter/resolve/main/pkg/currencyx/code.go
495 Bytes
| package currencyx | |
| import ( | |
| "errors" | |
| "fmt" | |
| "github.com/invopop/gobl/currency" | |
| ) | |
| var _ fmt.Stringer = (*Code)(nil) | |
| // Code represents a fiat or custom currency code. Code values used directly as | |
| // Currency values are treated as fiat currencies for backwards compatibility. | |
| type Code currency.Code | |
| func (c Code) String() string { | |
| return string(c) | |
| } | |
| func (c Code) Validate() error { | |
| if c == "" { | |
| return errors.New("currency code is required") | |
| } | |
| return currency.Code(c).Validate() | |
| } | |