models

package
v0.0.0-...-db63c97 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBilling

func AddBilling(m *BillingAccount) (id int64, err error)

AddBilling insert a new Account into database and returns last inserted Id on success.

func AddBillingTransaction

func AddBillingTransaction(m *BillingTransaction) (id int64, err error)

AddBillingTransaction insert a new BillingTransaction into database and returns last inserted Id on success.

func DeleteBilling

func DeleteBilling(id int64) (err error)

DeleteBilling deletes BillingAccount by Id and returns error if the record to be deleted doesn't exist

func DeleteBillingTransaction

func DeleteBillingTransaction(id int64) (err error)

DeleteBillingTransaction deletes BillingTransaction by Id and returns error if the record to be deleted doesn't exist

func GetAllBilling

func GetAllBilling(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllBilling retrieves all BillingAccount matches certain condition. Returns empty list if no records exist

func GetAllBillingTransaction

func GetAllBillingTransaction(query map[string]string, fields []string, sortby []string, order []string,
	offset int64, limit int64) (ml []interface{}, err error)

GetAllBillingTransaction retrieves all BillingTransaction matches certain condition. Returns empty list if no records exist

func UpdateBillingById

func UpdateBillingById(m *BillingAccount) (err error)

UpdateBilling updates BillingAccount by Id and returns error if the record to be updated doesn't exist

func UpdateBillingTransactionById

func UpdateBillingTransactionById(m *BillingTransaction) (err error)

UpdateBillingTransaction updates BillingTransaction by Id and returns error if the record to be updated doesn't exist

Types

type BaseModel

type BaseModel struct {
	Created   time.Time `orm:"auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"auto_now;type(datetime)"`
	CreatedBy string
	Token     string
	OwnerId   string
}

func (*BaseModel) MetaData

func (b *BaseModel) MetaData(userId string)

func (*BaseModel) TableIndex

func (b *BaseModel) TableIndex() [][]string

multiple fields index

type BillingAccount

type BillingAccount struct {
	Id int64 `orm:"auto"`
	BaseModel
	Balance int
}

func GetBillingById

func GetBillingById(id int64) (v *BillingAccount, err error)

GetBillingById retrieves BillingAccount by Id. Returns error if Id doesn't exist

func (*BillingAccount) TableUnique

func (b *BillingAccount) TableUnique() [][]string

type BillingTransaction

type BillingTransaction struct {
	Id int64 `orm:"auto"`
	BaseModel
	Status        TransactionStatus
	TransactionId string
	ExternalId    string
	Provider      string `orm:"size(128)"`
	Amount        int
	Description   string
}

func GetBillingTransactionById

func GetBillingTransactionById(id int64) (v *BillingTransaction, err error)

GetBillingTransactionById retrieves BillingTransaction by Id. Returns error if Id doesn't exist

type TransactionStatus

type TransactionStatus string
const (
	PENDING TransactionStatus = "PENDING"
	FAILED  TransactionStatus = "FAILED"
	SUCCESS TransactionStatus = "SUCCESS"
)

Jump to

Keyboard shortcuts

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