dao

package
v0.0.0-...-f0e17bc Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB() error

Types

type Account

type Account struct {
	*MongoDB
	*Cockroach
}

type Cockroach

type Cockroach struct {
	// contains filtered or unexported fields
}

func (*Cockroach) GetAccount

func (g *Cockroach) GetAccount(ops types.UserQueryOpts) (*types.Account, error)

func (*Cockroach) GetPayment

func (g *Cockroach) GetPayment(ops types.UserQueryOpts, startTime, endTime time.Time) ([]types.Payment, error)

func (*Cockroach) GetRechargeAmount

func (g *Cockroach) GetRechargeAmount(ops types.UserQueryOpts, startTime, endTime time.Time) (int64, error)

func (*Cockroach) GetTransfer

func (g *Cockroach) GetTransfer(ops *types.UserQueryOpts) ([]types.Transfer, error)

func (*Cockroach) SetPaymentInvoice

func (g *Cockroach) SetPaymentInvoice(req *helper.SetPaymentInvoiceReq) error

func (*Cockroach) Transfer

func (g *Cockroach) Transfer(req *helper.TransferAmountReq) error

type Interface

type Interface interface {
	GetBillingHistoryNamespaceList(req *helper.NamespaceBillingHistoryReq) ([]string, error)
	GetProperties() ([]common.PropertyQuery, error)
	GetCosts(user string, startTime, endTime time.Time) (common.TimeCostsMap, error)
	GetConsumptionAmount(user string, startTime, endTime time.Time) (int64, error)
	GetRechargeAmount(ops types.UserQueryOpts, startTime, endTime time.Time) (int64, error)
	GetPropertiesUsedAmount(user string, startTime, endTime time.Time) (map[string]int64, error)
	GetAccount(ops types.UserQueryOpts) (*types.Account, error)
	GetPayment(ops types.UserQueryOpts, startTime, endTime time.Time) ([]types.Payment, error)
	SetPaymentInvoice(req *helper.SetPaymentInvoiceReq) error
	Transfer(req *helper.TransferAmountReq) error
	GetTransfer(ops *types.UserQueryOpts) ([]types.Transfer, error)
}
var DBClient Interface

func NewAccountInterface

func NewAccountInterface(mongoURI, globalCockRoachURI, localCockRoachURI string) (Interface, error)

type MongoDB

type MongoDB struct {
	Client         *mongo.Client
	AccountDBName  string
	BillingConn    string
	PropertiesConn string
	Properties     *resources.PropertyTypeLS
}

func (*MongoDB) GetBillingHistoryNamespaceList

func (m *MongoDB) GetBillingHistoryNamespaceList(req *helper.NamespaceBillingHistoryReq) ([]string, error)

func (*MongoDB) GetConsumptionAmount

func (m *MongoDB) GetConsumptionAmount(user string, startTime, endTime time.Time) (int64, error)

func (*MongoDB) GetCosts

func (m *MongoDB) GetCosts(user string, startTime, endTime time.Time) (common.TimeCostsMap, error)

func (*MongoDB) GetProperties

func (m *MongoDB) GetProperties() ([]common.PropertyQuery, error)

func (*MongoDB) GetPropertiesUsedAmount

func (m *MongoDB) GetPropertiesUsedAmount(user string, startTime, endTime time.Time) (map[string]int64, error)

Jump to

Keyboard shortcuts

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