Documentation
¶
Index ¶
- func CalculateNetAmount(amount int64, discount int16) (int64, error)
- func CapitalizeWords(s string) string
- func CheckPassword(password, hash string) error
- func HashPassword(password string) (string, error)
- func RandomAmount() int64
- func RandomAttributeValue() string
- func RandomCode() string
- func RandomCurrency() string
- func RandomDiscount() int16
- func RandomEmail() string
- func RandomInt(min, max int64) int64
- func RandomLongitudeLatitude() sql.NullFloat64
- func RandomName() string
- func RandomNumber() int64
- func RandomPhone() string
- func RandomQuantity() int64
- func RandomString(n int) string
- type Config
- type RotatingLogWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CapitalizeWords ¶ added in v1.1.0
CapitalizeWords upper-cases the first letter of each space-separated word and collapses runs of whitespace, so " alex sal" becomes "Alex Sal". The rest of each word is left as typed ("McDonald" stays "McDonald").
func CheckPassword ¶
func HashPassword ¶
func RandomAmount ¶
func RandomAmount() int64
func RandomAttributeValue ¶
func RandomAttributeValue() string
func RandomCode ¶
func RandomCode() string
func RandomCurrency ¶
func RandomCurrency() string
func RandomDiscount ¶
func RandomDiscount() int16
func RandomEmail ¶
func RandomEmail() string
func RandomLongitudeLatitude ¶
func RandomLongitudeLatitude() sql.NullFloat64
func RandomName ¶
func RandomName() string
func RandomNumber ¶
func RandomNumber() int64
func RandomPhone ¶
func RandomPhone() string
func RandomQuantity ¶
func RandomQuantity() int64
func RandomString ¶
Types ¶
type Config ¶
type Config struct {
DBDriver string `mapstructure:"DB_DRIVER"`
DBSource string `mapstructure:"DB_SOURCE"`
HTTPServerAddress string `mapstructure:"HTTP_SERVER_ADDRESS"`
GRPCServerAddress string `mapstructure:"GRPC_SERVER_ADDRESS"`
GatewayServerAddress string `mapstructure:"GATEWAY_SERVER_ADDRESS"`
TokenSymmetricKey string `mapstructure:"TOKEN_SYMMETRIC_KEY"`
AccessTokenDuration time.Duration `mapstructure:"access_token_duration"`
RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
// ExpenseImageStorageDir is where receipt photos uploaded through the
// one-time QR flow (api/expense_upload.go) are saved on local disk.
ExpenseImageStorageDir string `mapstructure:"EXPENSE_IMAGE_STORAGE_DIR"`
// ShiftReceiptImageStorageDir is where close-shift receipt photos
// forwarded by kashi-pos (api/branch_shift_receipt_image.go) are saved.
// Defaults to ./storage/shift_receipt_images when unset.
ShiftReceiptImageStorageDir string `mapstructure:"SHIFT_RECEIPT_IMAGE_STORAGE_DIR"`
// TransferAttachmentStorageDir is where the optional photo attached to
// a branch-initiated transfer request (api/branch_transfer.go) is
// saved. Defaults to ./storage/transfer_attachments when unset.
TransferAttachmentStorageDir string `mapstructure:"TRANSFER_ATTACHMENT_STORAGE_DIR"`
// AppReleaseStorageDir is where till app builds published for remote
// update (api/app_update.go) are saved. Defaults to
// ./storage/app_releases when unset.
AppReleaseStorageDir string `mapstructure:"APP_RELEASE_STORAGE_DIR"`
// GeoIPDir holds the DB-IP lite databases the Security page locates
// visitors with (api/geoip.go downloads them). Defaults to
// ./storage/geoip when unset.
GeoIPDir string `mapstructure:"GEOIP_DIR"`
// AppLogPath is the bounded, rotating backend log file. It defaults to
// logs/kashi.log when APP_LOG_PATH is not set.
AppLogPath string `mapstructure:"APP_LOG_PATH"`
// ResendAPIKey sends emailed invoice reports (api/email_report.go)
// through Resend. Unset means email is off on this server.
ResendAPIKey string `mapstructure:"RESEND_API_KEY"`
}
func LoadConfig ¶
type RotatingLogWriter ¶
type RotatingLogWriter struct {
// contains filtered or unexported fields
}
RotatingLogWriter keeps the active log and one backup, bounding total disk usage to roughly 10 MB. Writes are serialized so concurrent HTTP handlers cannot rotate or write the file at the same time.
func ConfigureAppLogging ¶
func ConfigureAppLogging(path string) (*RotatingLogWriter, error)
ConfigureAppLogging retains normal console output and mirrors all standard Go log messages to the bounded rotating file.
func (*RotatingLogWriter) Close ¶
func (writer *RotatingLogWriter) Close() error
func (*RotatingLogWriter) Path ¶
func (writer *RotatingLogWriter) Path() string
Click to show internal directories.
Click to hide internal directories.