mongodb

package
v0.0.0-...-e78d781 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOffer

func CreateOffer(mongoUri string, sugar *zap.SugaredLogger, alias string, address string, paymentId string, bazaarUuid string) error

func CreateTx

func CreateTx(mongoUri string, sugar *zap.SugaredLogger, amount int64, assetId string, paymentId string, txHash string) error

func UpdateBalance

func UpdateBalance(mongoUri string, mongoId primitive.ObjectID, asset string, newZanoBalance int64, newRackzBalance int64) error

Types

type Address

type Address struct {
	IntegratedAddress string `json:"integrated_address" bson:"integrated_address"`
	PaymentId         string `json:"payment_id" bson:"payment_id"`
}

type Balance

type Balance struct {
	Zano  int64 `json:"zano" bson:"zano"`
	Rackz int64 `json:"rackz" bson:"rackz"`
}

type BazaarSchema

type BazaarSchema struct {
	ID           primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
	CreationTime int64              `json:"creation_time" bson:"creation_time"`
	Alias        string             `json:"alias" bson:"alias"`
	Address      Address            `json:"address" bson:"address"`
	Balance      Balance            `json:"balance" bson:"balance"`
	Owner        Owner              `json:"owner" bson:"owner"`
	Uuid         string             `json:"uuid" bson:"uuid"`
}

func ReadBazaar

func ReadBazaar(mongoUri string, paymentId string) (BazaarSchema, error)

func ReadOffers

func ReadOffers(mongoUri string, sugar *zap.SugaredLogger) ([]BazaarSchema, error)

type BazaarsDb

type BazaarsDb struct {
	ID      string `bson:"_id,omitempty"`
	Alias   string `bson:"alias,omitempty"`
	Address struct {
		IntegratedAddress string `bson:"integrated_address,omitempty"`
		PaymentId         string `bson:"payment_id,omitempty"`
		Comment           string `json:"comment"`
	} `json:"address_details"`
	Balance struct {
		Zano int64 `bson:"zano,omitempty"`
		Rack int64 `bson:"rack,omitempty"`
	} `json:"balance"`
	BazaarUuid string `json:"bazaar_uuid"`
}

type Owner

type Owner struct {
	Username string `json:"username" bson:"username"`
	UserId   string `json:"user_id" bson:"user_id"`
}

type TxSchema

type TxSchema struct {
	ID           primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	CreationTime int64              `json:"creation_time" bson:"creation_time"`
	Amount       int64              `json:"amount" bson:"amount"`
	AssetId      string             `json:"asset_id" bson:"asset_id"`
	PaymentId    string             `json:"payment_id" bson:"payment_id"`
	TxHash       string             `json:"tx_hash" bson:"tx_hash"`
}

func ReadTxs

func ReadTxs(mongoUri string) ([]TxSchema, error)

Jump to

Keyboard shortcuts

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