db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Database struct {
		MySql  *MySqlConfig  `json:"mySql" yaml:"mySql"`
		Sqlite *SqliteConfig `json:"sqlite" yaml:"sqlite"`
	} `json:"database" yaml:"database"`
}
var Config Configuration

type GetKeySetOptions added in v0.1.7

type GetKeySetOptions func(db *gorm.DB) *gorm.DB

func KeySetWithId added in v0.1.7

func KeySetWithId(id string) GetKeySetOptions

func KeySetWithMintUrl added in v0.1.7

func KeySetWithMintUrl(mintUrl string) GetKeySetOptions

type MintStorage

type MintStorage interface {
	GetUsedProofs(secrets ...string) ([]cashu.Proof, error)
	GetReservedProofs() ([]cashu.Proof, error)
	ProofsUsed([]string) []cashu.Proof
	StoreProof(proof cashu.Proof) error
	DeleteProof(proof cashu.Proof) error
	StoreUsedProofs(proof cashu.ProofsUsed) error
	StorePromise(p cashu.Promise) error
	StoreScript(p cashu.P2SHScript) error
	GetScripts(address string) ([]cashu.P2SHScript, error)
	StoreLightningInvoice(i lightning.Invoicer) error
	GetLightningInvoice(hash string) (lightning.Invoicer, error)
	GetLightningInvoices(paid bool) ([]invoice.Invoice, error) // todo -- the return type of this interface function must be of type lightning.Invoicer
	UpdateLightningInvoice(hash string, options ...UpdateInvoiceOptions) error
	GetKeySet(options ...GetKeySetOptions) ([]crypto.KeySet, error)
	StoreKeySet(k crypto.KeySet) error
	Migrate(interface{}) error
}

func NewSqlDatabase

func NewSqlDatabase() MintStorage

type MySqlConfig

type MySqlConfig struct {
	Host string `json:"host" yaml:"host"`
	Port string `json:"port" yaml:"port"`
}

type SqlDatabase

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

func (SqlDatabase) DeleteProof

func (s SqlDatabase) DeleteProof(proof cashu.Proof) error

func (SqlDatabase) GetKeySet added in v0.1.7

func (s SqlDatabase) GetKeySet(options ...GetKeySetOptions) ([]crypto.KeySet, error)

func (SqlDatabase) GetLightningInvoice

func (s SqlDatabase) GetLightningInvoice(hash string) (lightning.Invoicer, error)

GetLightningInvoice reads lighting invoice from db

func (SqlDatabase) GetLightningInvoices

func (s SqlDatabase) GetLightningInvoices(paid bool) ([]invoice.Invoice, error)

GetLightningInvoices

func (SqlDatabase) GetReservedProofs

func (s SqlDatabase) GetReservedProofs() ([]cashu.Proof, error)

func (SqlDatabase) GetScripts

func (s SqlDatabase) GetScripts(address string) ([]cashu.P2SHScript, error)

func (SqlDatabase) GetUsedProofs

func (s SqlDatabase) GetUsedProofs(secrets ...string) ([]cashu.Proof, error)

GetUsedProofs reads all proofs from db

func (SqlDatabase) Migrate

func (s SqlDatabase) Migrate(object interface{}) error

func (SqlDatabase) ProofsUsed

func (s SqlDatabase) ProofsUsed(in []string) []cashu.Proof

func (SqlDatabase) StoreKeySet added in v0.1.7

func (s SqlDatabase) StoreKeySet(k crypto.KeySet) error

func (SqlDatabase) StoreLightningInvoice

func (s SqlDatabase) StoreLightningInvoice(i lightning.Invoicer) error

StoreLightningInvoice will store lightning invoice in db

func (SqlDatabase) StorePromise

func (s SqlDatabase) StorePromise(p cashu.Promise) error

StorePromise will write promise to db

func (SqlDatabase) StoreProof

func (s SqlDatabase) StoreProof(p cashu.Proof) error

StoreProof will write proof to db

func (SqlDatabase) StoreScript

func (s SqlDatabase) StoreScript(p cashu.P2SHScript) error

func (SqlDatabase) StoreUsedProofs

func (s SqlDatabase) StoreUsedProofs(proof cashu.ProofsUsed) error

func (SqlDatabase) UpdateLightningInvoice

func (s SqlDatabase) UpdateLightningInvoice(hash string, options ...UpdateInvoiceOptions) error

UpdateLightningInvoice updates lightning invoice in db

type SqliteConfig

type SqliteConfig struct {
	Path     string `json:"path" yaml:"path"`
	FileName string `json:"filename" yaml:"filename"`
}

type UpdateInvoiceOptions

type UpdateInvoiceOptions func(invoice lightning.Invoicer)

func UpdateInvoicePaid

func UpdateInvoicePaid(paid bool) UpdateInvoiceOptions

func UpdateInvoiceTimePaid

func UpdateInvoiceTimePaid(t time.Time) UpdateInvoiceOptions

func UpdateInvoiceWithIssued

func UpdateInvoiceWithIssued(issued bool) UpdateInvoiceOptions

Jump to

Keyboard shortcuts

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