common

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BillingTypeWater BillingAccountType = "water"
	BillingTypePower BillingAccountType = "power"

	BillingModePrepaid  BillingMode = "prepaid"
	BillingModePostpaid BillingMode = "postpaid"

	BalanceUnitKES    BalanceUnit = "KES"
	BalanceUnitKWH    BalanceUnit = "kWh"
	BalanceUnitLitres BalanceUnit = "litres"

	ValueModeWallet AccountValueMode = "wallet"
	ValueModeToken  AccountValueMode = "token"
)

Variables

Functions

This section is empty.

Types

type AccountValueMode

type AccountValueMode string

type BalanceUnit

type BalanceUnit string

type BaseModel

type BaseModel struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type BillingAccountType

type BillingAccountType string

type BillingMode

type BillingMode string

type CreditSource

type CreditSource string
const (
	CreditSourceMpesa    CreditSource = "mpesa"
	CreditSourceWallet   CreditSource = "wallet"
	CreditSourceReversal CreditSource = "reversal"
)

type InvoiceStatus

type InvoiceStatus string
const (
	InvoicePending InvoiceStatus = "pending"
	InvoicePaid    InvoiceStatus = "paid"
	InvoiceOverdue InvoiceStatus = "overdue"
)

type JSONTime

type JSONTime time.Time

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON converts JSONTime to JSON string

func (JSONTime) String

func (t JSONTime) String() string

String returns the ISO time format

func (JSONTime) ToTime

func (t JSONTime) ToTime() time.Time

ToTime converts to standard time.Time

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(data []byte) error

UnmarshalJSON parses JSON string to JSONTime

type MeterEventType

type MeterEventType string
const (
	EventPowerOn    MeterEventType = "power_on"
	EventPowerOff   MeterEventType = "power_off"
	EventValveOpen  MeterEventType = "valve_open"
	EventValveClose MeterEventType = "valve_close"
	EventReading    MeterEventType = "reading"
	EventTamper     MeterEventType = "tamper"
	EventLeak       MeterEventType = "leak"
	EventLowBattery MeterEventType = "low_battery"
)

type NegativeStatus

type NegativeStatus string
const (
	NegativeStatusUnresolved NegativeStatus = "unresolved"
	NegativeStatusResolved   NegativeStatus = "resolved"
	NegativeStatusFlagged    NegativeStatus = "flagged"
)

type Permission

type Permission string
const (
	// Account management
	PermCreateAccount Permission = "account:create"
	PermViewAccount   Permission = "account:view"
	PermEditAccount   Permission = "account:edit"

	// Tenant management
	PermCreateTenant Permission = "tenant:create"
	PermViewTenant   Permission = "tenant:view"

	// Meter management
	PermReadMeter   Permission = "meter:read"
	PermUpdateMeter Permission = "meter:update"

	// Billing
	PermViewBilling     Permission = "billing:view"
	PermGenerateInvoice Permission = "billing:invoice"

	// Support
	PermManageTickets Permission = "support:manage"

	// System
	PermAuditAccess Permission = "audit:read"
)

func AllPermissions added in v1.0.5

func AllPermissions() []Permission

AllPermissions returns a list of all available permissions

type PrepaidDebitReason

type PrepaidDebitReason string
const (
	DebitReasonUsage      PrepaidDebitReason = "usage"      // based on consumption
	DebitReasonInvoice    PrepaidDebitReason = "invoice"    // postpaid invoice deduction
	DebitReasonCorrection PrepaidDebitReason = "correction" // manual admin adjustment
	DebitReasonReversal   PrepaidDebitReason = "reversal"   // reversal of a previous incorrect debit
)

type RateType

type RateType string
const (
	RateTypeFixed   RateType = "Fixed"
	RateTypeFormula RateType = "Formula"
)

type StringArray

type StringArray []string

func (*StringArray) Scan

func (a *StringArray) Scan(value interface{}) error

func (StringArray) Value

func (a StringArray) Value() (driver.Value, error)

type TicketStatus

type TicketStatus string
const (
	TicketOpen     TicketStatus = "open"
	TicketPending  TicketStatus = "pending"
	TicketResolved TicketStatus = "resolved"
	TicketClosed   TicketStatus = "closed"
)

type TransactionStatus

type TransactionStatus string
const (
	TransactionStatusPending   TransactionStatus = "pending"
	TransactionStatusConfirmed TransactionStatus = "confirmed"
	TransactionStatusFailed    TransactionStatus = "failed"
)

type TransactionType

type TransactionType string
const (
	TransactionTypeMpesa  TransactionType = "mpesa"
	TransactionTypeWallet TransactionType = "wallet"
	TransactionTypeToken  TransactionType = "token"
)

type UserRole

type UserRole string
const (
	AdminUser    UserRole = "admin"
	AccountUser  UserRole = "account_user"
	PropertyUser UserRole = "property_user"
	Technician   UserRole = "technician"
)

type UtilityType

type UtilityType string
const (
	WaterMeter UtilityType = "water"
	PowerMeter UtilityType = "power"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL