package
Version:
v0.0.0-...-3978a51
Opens a new window with list of versions in this module.
Published: Apr 4, 2024
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
NewErrorf instantiates a new error.
WrapErrorf returns a wrapped error.
type Account struct {
ID int64 `json:"id"`
UserID int64 `json:"-"`
Balance USD `json:"balance"`
CreatedAt time.Time `json:"-"`
}
type BalanceUpdateRequest struct {
Amount USD `json:"amount"`
}
Error represents an error that could be wrapping another error, it includes a code for determining what
triggered the error.
Code returns the code representing this error.
Error returns the message, when wrapping errors the wrapped error is returned.
Message returns the custom message of the error.
Unwrap returns the wrapped error, if any.
ErrorCode defines supported error codes.
const (
ErrorCodeUnknown ErrorCode = iota
ErrorCodeNotFound
ErrorCodeInvalidArgument
ErrorCodeDuplicate
ErrorCodeUnauthorized
)
USD represents US dollar amount in terms of cents
ToUSD converts a float64 to USD
e.g. 1.23 to $1.23, 1.345 to $1.35
Float64 converts a USD to float64
Multiply safely multiplies a USD value by a float64, rounding
to the nearest cent.
String returns a formatted USD value
type User struct {
ID int64 `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Password string `json:"-"`
CreatedAt time.Time `json:"createdAt,omitempty"`
}
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.