How klokare/decimal works
This is a dependency-free Go library implementing .NET-compatible 96-bit fixed-point decimal values. Its main workflow is constructing or parsing a Decimal, performing arithmetic and rounding, then formatting or converting the result. It also provides JSON, binary/.NET-layout, and database/sql interoperability. The arithmetic excerpts are partial, so the graph shows the documented core/helper relationship without detailing individual arithmetic operations.
Main entry points: decimal.go Decimal API · parse.go Parse values · encoding.go Text and binary encodings · format.go Format values
Components 13
Decimal core
- Decimal API
decimal.go - Arithmetic core
calc.go - Word buffers
buf.go - Errors and recovery
errors.go
Text and formats
- Parse values
parse.go - Format values
format.go - Number formats
numberformat.go
Interoperability
- Text and binary encodings
encoding.go - SQL adapter
sql.go
Other components
- Go caller
- JSON consumer
- SQL driver
- .NET peer
Connections 19
- Go caller → Decimal API: constructs and operates
- Go caller → Parse values: parses text
- Parse values → Decimal API: builds values
- Decimal API → Arithmetic core: uses arithmetic
- Arithmetic core → Word buffers: uses word operations
- Decimal API → Errors and recovery: reports failures
- Parse values → Errors and recovery: reports syntax errors
- Go caller → Format values: formats values
- Format values → Number formats: uses symbols and patterns
- Format values → Errors and recovery: reports format errors
- Decimal API → Text and binary encodings: provides value encoding
- Text and binary encodings → Format values: formats text
- Text and binary encodings → Parse values: parses text
- JSON consumer → Text and binary encodings: marshals and unmarshals
- SQL driver → SQL adapter: scans and values
- SQL adapter → Decimal API: converts values
- SQL adapter → Parse values: parses text values
- Go caller → SQL adapter: uses SQL values
- .NET peer → Text and binary encodings: exchanges .NET bytes