db

package
v0.0.0-...-8d0bd56 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SettingsNotSetError = errors.New("settings not set")

Functions

func CoinTypeForContract

func CoinTypeForContract(contract *pb.RicardianContract) string

func NewCaseStore

func NewCaseStore(db *sql.DB, lock *sync.Mutex) repo.CaseStore

func NewChatStore

func NewChatStore(db *sql.DB, lock *sync.Mutex) repo.ChatStore

func NewConfigurationStore

func NewConfigurationStore(db *sql.DB, lock *sync.Mutex) repo.ConfigurationStore

func NewCouponStore

func NewCouponStore(db *sql.DB, lock *sync.Mutex) repo.CouponStore

func NewFollowerStore

func NewFollowerStore(db *sql.DB, lock *sync.Mutex) repo.FollowerStore

func NewFollowingStore

func NewFollowingStore(db *sql.DB, lock *sync.Mutex) repo.FollowingStore

func NewInventoryStore

func NewInventoryStore(db *sql.DB, lock *sync.Mutex) repo.InventoryStore

func NewKeyStore

func NewKeyStore(db *sql.DB, lock *sync.Mutex, coinType wallet.CoinType) repo.KeyStore

func NewMessageStore

func NewMessageStore(db *sql.DB, lock *sync.Mutex) repo.MessageStore

NewMessageStore return new MessagesDB

func NewModeratedStore

func NewModeratedStore(db *sql.DB, lock *sync.Mutex) repo.ModeratedStore

func NewNotificationStore

func NewNotificationStore(db *sql.DB, lock *sync.Mutex) repo.NotificationStore

func NewOfflineMessageStore

func NewOfflineMessageStore(db *sql.DB, lock *sync.Mutex) repo.OfflineMessageStore

func NewPointerStore

func NewPointerStore(db *sql.DB, lock *sync.Mutex) repo.PointerStore

func NewPurchaseStore

func NewPurchaseStore(db *sql.DB, lock *sync.Mutex) repo.PurchaseStore

func NewSaleStore

func NewSaleStore(db *sql.DB, lock *sync.Mutex) repo.SaleStore

func NewSpentTransactionStore

func NewSpentTransactionStore(db *sql.DB, lock *sync.Mutex, coinType wallet.CoinType) repo.SpentTransactionOutputStore

func NewTransactionMetadataStore

func NewTransactionMetadataStore(db *sql.DB, lock *sync.Mutex) repo.TransactionMetadataStore

func NewTransactionStore

func NewTransactionStore(db *sql.DB, lock *sync.Mutex, coinType wallet.CoinType) repo.TransactionStore

func NewUnspentTransactionStore

func NewUnspentTransactionStore(db *sql.DB, lock *sync.Mutex, coinType wallet.CoinType) repo.UnspentTransactionOutputStore

func NewWatchedScriptStore

func NewWatchedScriptStore(db *sql.DB, lock *sync.Mutex, coinType wallet.CoinType) repo.WatchedScriptStore

func PaymentCoinForContract

func PaymentCoinForContract(contract *pb.RicardianContract) (string, error)

Types

type CasesDB

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

func (*CasesDB) BeginTransaction

func (m *CasesDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*CasesDB) Count

func (c *CasesDB) Count() int

func (*CasesDB) Delete

func (c *CasesDB) Delete(orderID string) error

func (*CasesDB) ExecuteQuery

func (m *CasesDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*CasesDB) GetAll

func (c *CasesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Case, int, error)

func (*CasesDB) GetByCaseID

func (c *CasesDB) GetByCaseID(caseID string) (*repo.DisputeCaseRecord, error)

func (*CasesDB) GetCaseMetadata

func (c *CasesDB) GetCaseMetadata(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerValidationErrors, vendorValidationErrors []string, state pb.OrderState, read bool, timestamp time.Time, buyerOpened bool, claim string, resolution *pb.DisputeResolution, err error)

func (*CasesDB) GetDisputesForDisputeExpiryNotification

func (c *CasesDB) GetDisputesForDisputeExpiryNotification() ([]*repo.DisputeCaseRecord, error)

GetDisputesForDisputeExpiryNotification returns []*repo.DisputeCaseRecord including each record which needs Notifications to be generated. Currently, notifications are generated at 0, 15, 30, 44, and 45 days after opening.

func (*CasesDB) Lock

func (m *CasesDB) Lock()

func (*CasesDB) MarkAsClosed

func (c *CasesDB) MarkAsClosed(caseID string, resolution *pb.DisputeResolution) error

func (*CasesDB) MarkAsRead

func (c *CasesDB) MarkAsRead(orderID string) error

func (*CasesDB) MarkAsUnread

func (c *CasesDB) MarkAsUnread(orderID string) error

func (*CasesDB) PrepareAndExecuteQuery

func (m *CasesDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*CasesDB) PrepareQuery

func (m *CasesDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*CasesDB) Put

func (c *CasesDB) Put(caseID string, state pb.OrderState, buyerOpened bool, claim string, paymentCoin string, coinType string) error

func (*CasesDB) PutRecord

func (c *CasesDB) PutRecord(dispute *repo.DisputeCaseRecord) error

func (*CasesDB) Unlock

func (m *CasesDB) Unlock()

func (*CasesDB) UpdateBuyerInfo

func (c *CasesDB) UpdateBuyerInfo(caseID string, buyerContract *pb.RicardianContract, buyerValidationErrors []string, buyerPayoutAddress string, buyerOutpoints []*pb.Outpoint) error

func (*CasesDB) UpdateDisputesLastDisputeExpiryNotifiedAt

func (c *CasesDB) UpdateDisputesLastDisputeExpiryNotifiedAt(disputeCases []*repo.DisputeCaseRecord) error

UpdateDisputesLastDisputeExpiryNotifiedAt accepts []*repo.DisputeCaseRecord and updates each DisputeCaseRecord by their CaseID to the set LastDisputeExpiryNotifiedAt value. The update will be attempted atomically with a rollback attempted in the event of an error.

func (*CasesDB) UpdateVendorInfo

func (c *CasesDB) UpdateVendorInfo(caseID string, vendorContract *pb.RicardianContract, vendorValidationErrors []string, vendorPayoutAddress string, vendorOutpoints []*pb.Outpoint) error

type ChatDB

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

func (*ChatDB) BeginTransaction

func (m *ChatDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*ChatDB) DeleteConversation

func (c *ChatDB) DeleteConversation(peerId string) error

func (*ChatDB) DeleteMessage

func (c *ChatDB) DeleteMessage(msgID string) error

func (*ChatDB) ExecuteQuery

func (m *ChatDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*ChatDB) GetConversations

func (c *ChatDB) GetConversations() []repo.ChatConversation

func (*ChatDB) GetMessages

func (c *ChatDB) GetMessages(peerID string, subject string, offsetId string, limit int) []repo.ChatMessage

func (*ChatDB) GetUnreadCount

func (c *ChatDB) GetUnreadCount(subject string) (int, error)

func (*ChatDB) Lock

func (m *ChatDB) Lock()

func (*ChatDB) MarkAsRead

func (c *ChatDB) MarkAsRead(peerID string, subject string, outgoing bool, messageId string) (string, bool, error)

func (*ChatDB) PrepareAndExecuteQuery

func (m *ChatDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*ChatDB) PrepareQuery

func (m *ChatDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*ChatDB) Put

func (c *ChatDB) Put(messageId string, peerId string, subject string, message string, timestamp time.Time, read bool, outgoing bool) error

func (*ChatDB) Unlock

func (m *ChatDB) Unlock()

type ConfigDB

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

func (*ConfigDB) BeginTransaction

func (m *ConfigDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*ConfigDB) ExecuteQuery

func (m *ConfigDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*ConfigDB) GetCreationDate

func (c *ConfigDB) GetCreationDate() (time.Time, error)

func (*ConfigDB) GetIdentityKey

func (c *ConfigDB) GetIdentityKey() ([]byte, error)

func (*ConfigDB) GetMnemonic

func (c *ConfigDB) GetMnemonic() (string, error)

func (*ConfigDB) Init

func (c *ConfigDB) Init(mnemonic string, identityKey []byte, password string, creationDate time.Time) error

func (*ConfigDB) IsEncrypted

func (c *ConfigDB) IsEncrypted() bool

func (*ConfigDB) Lock

func (m *ConfigDB) Lock()

func (*ConfigDB) PrepareAndExecuteQuery

func (m *ConfigDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*ConfigDB) PrepareQuery

func (m *ConfigDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*ConfigDB) Unlock

func (m *ConfigDB) Unlock()

type CouponDB

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

func (*CouponDB) BeginTransaction

func (m *CouponDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*CouponDB) Delete

func (c *CouponDB) Delete(slug string) error

func (*CouponDB) ExecuteQuery

func (m *CouponDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*CouponDB) Get

func (c *CouponDB) Get(slug string) ([]repo.Coupon, error)

func (*CouponDB) Lock

func (m *CouponDB) Lock()

func (*CouponDB) PrepareAndExecuteQuery

func (m *CouponDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*CouponDB) PrepareQuery

func (m *CouponDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*CouponDB) Put

func (c *CouponDB) Put(coupons []repo.Coupon) error

func (*CouponDB) Unlock

func (m *CouponDB) Unlock()

type DB

type DB struct {
	SqlDB *sql.DB
	Lock  *sync.Mutex
}

type FollowerDB

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

func (*FollowerDB) BeginTransaction

func (m *FollowerDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*FollowerDB) Count

func (f *FollowerDB) Count() int

func (*FollowerDB) Delete

func (f *FollowerDB) Delete(follower string) error

func (*FollowerDB) ExecuteQuery

func (m *FollowerDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*FollowerDB) FollowsMe

func (f *FollowerDB) FollowsMe(peerId string) bool

func (*FollowerDB) Get

func (f *FollowerDB) Get(offsetId string, limit int) ([]repo.Follower, error)

func (*FollowerDB) Lock

func (m *FollowerDB) Lock()

func (*FollowerDB) PrepareAndExecuteQuery

func (m *FollowerDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*FollowerDB) PrepareQuery

func (m *FollowerDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*FollowerDB) Put

func (f *FollowerDB) Put(follower string, proof []byte) error

func (*FollowerDB) Unlock

func (m *FollowerDB) Unlock()

type FollowingDB

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

func (*FollowingDB) BeginTransaction

func (m *FollowingDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*FollowingDB) Count

func (f *FollowingDB) Count() int

func (*FollowingDB) Delete

func (f *FollowingDB) Delete(follower string) error

func (*FollowingDB) ExecuteQuery

func (m *FollowingDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*FollowingDB) Get

func (f *FollowingDB) Get(offsetId string, limit int) ([]string, error)

func (*FollowingDB) IsFollowing

func (f *FollowingDB) IsFollowing(peerId string) bool

func (*FollowingDB) Lock

func (m *FollowingDB) Lock()

func (*FollowingDB) PrepareAndExecuteQuery

func (m *FollowingDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*FollowingDB) PrepareQuery

func (m *FollowingDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*FollowingDB) Put

func (f *FollowingDB) Put(follower string) error

func (*FollowingDB) Unlock

func (m *FollowingDB) Unlock()

type InventoryDB

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

func (*InventoryDB) BeginTransaction

func (m *InventoryDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*InventoryDB) Delete

func (i *InventoryDB) Delete(slug string, variantIndex int) error

func (*InventoryDB) DeleteAll

func (i *InventoryDB) DeleteAll(slug string) error

func (*InventoryDB) ExecuteQuery

func (m *InventoryDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*InventoryDB) Get

func (i *InventoryDB) Get(slug string) (map[int]*big.Int, error)

func (*InventoryDB) GetAll

func (i *InventoryDB) GetAll() (map[string]map[int]*big.Int, error)

func (*InventoryDB) GetSpecific

func (i *InventoryDB) GetSpecific(slug string, variantIndex int) (*big.Int, error)

func (*InventoryDB) Lock

func (m *InventoryDB) Lock()

func (*InventoryDB) PrepareAndExecuteQuery

func (m *InventoryDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*InventoryDB) PrepareQuery

func (m *InventoryDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*InventoryDB) Put

func (i *InventoryDB) Put(slug string, variantIndex int, count *big.Int) error

func (*InventoryDB) Unlock

func (m *InventoryDB) Unlock()

type KeysDB

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

func (*KeysDB) BeginTransaction

func (m *KeysDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*KeysDB) ExecuteQuery

func (m *KeysDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*KeysDB) GetAll

func (k *KeysDB) GetAll() ([]wallet.KeyPath, error)

func (*KeysDB) GetImported

func (k *KeysDB) GetImported() ([]*btcec.PrivateKey, error)

func (*KeysDB) GetKey

func (k *KeysDB) GetKey(scriptAddress []byte) (*btcec.PrivateKey, error)

func (*KeysDB) GetLastKeyIndex

func (k *KeysDB) GetLastKeyIndex(purpose wallet.KeyPurpose) (int, bool, error)

func (*KeysDB) GetLookaheadWindows

func (k *KeysDB) GetLookaheadWindows() map[wallet.KeyPurpose]int

func (*KeysDB) GetPathForKey

func (k *KeysDB) GetPathForKey(scriptAddress []byte) (wallet.KeyPath, error)

func (*KeysDB) GetUnused

func (k *KeysDB) GetUnused(purpose wallet.KeyPurpose) ([]int, error)

func (*KeysDB) ImportKey

func (k *KeysDB) ImportKey(scriptAddress []byte, key *btcec.PrivateKey) error

func (*KeysDB) Lock

func (m *KeysDB) Lock()

func (*KeysDB) MarkKeyAsUsed

func (k *KeysDB) MarkKeyAsUsed(scriptAddress []byte) error

func (*KeysDB) PrepareAndExecuteQuery

func (m *KeysDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*KeysDB) PrepareQuery

func (m *KeysDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*KeysDB) Put

func (k *KeysDB) Put(scriptAddress []byte, keyPath wallet.KeyPath) error

func (*KeysDB) Unlock

func (m *KeysDB) Unlock()

type MessagesDB

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

MessagesDB represents the messages table

func (*MessagesDB) BeginTransaction

func (m *MessagesDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*MessagesDB) ExecuteQuery

func (m *MessagesDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*MessagesDB) GetAllErrored

func (o *MessagesDB) GetAllErrored() ([]repo.OrderMessage, error)

GetAllErrored returns all messages which have an error state

func (*MessagesDB) GetByOrderIDType

func (o *MessagesDB) GetByOrderIDType(orderID string, mType pb.Message_MessageType) (*repo.Message, string, error)

GetByOrderIDType returns the message for the specified order and message type

func (*MessagesDB) Lock

func (m *MessagesDB) Lock()

func (*MessagesDB) MarkAsResolved

func (o *MessagesDB) MarkAsResolved(m repo.OrderMessage) error

MarkAsResolved sets a provided message as resolved

func (*MessagesDB) PrepareAndExecuteQuery

func (m *MessagesDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*MessagesDB) PrepareQuery

func (m *MessagesDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*MessagesDB) Put

func (o *MessagesDB) Put(messageID, orderID string, mType pb.Message_MessageType, peerID string, msg repo.Message, rErr string, receivedAt int64, pubkey []byte) error

Put will insert a record into the messages

func (*MessagesDB) Unlock

func (m *MessagesDB) Unlock()

type ModeratedDB

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

func (*ModeratedDB) BeginTransaction

func (m *ModeratedDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*ModeratedDB) Delete

func (m *ModeratedDB) Delete(follower string) error

func (*ModeratedDB) ExecuteQuery

func (m *ModeratedDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*ModeratedDB) Get

func (m *ModeratedDB) Get(offsetId string, limit int) ([]string, error)

func (*ModeratedDB) Lock

func (m *ModeratedDB) Lock()

func (*ModeratedDB) PrepareAndExecuteQuery

func (m *ModeratedDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*ModeratedDB) PrepareQuery

func (m *ModeratedDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*ModeratedDB) Put

func (m *ModeratedDB) Put(peerId string) error

func (*ModeratedDB) Unlock

func (m *ModeratedDB) Unlock()

type NotficationsDB

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

func (*NotficationsDB) BeginTransaction

func (m *NotficationsDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*NotficationsDB) Delete

func (n *NotficationsDB) Delete(notifID string) error

func (*NotficationsDB) ExecuteQuery

func (m *NotficationsDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*NotficationsDB) GetAll

func (n *NotficationsDB) GetAll(offsetId string, limit int, typeFilter []string) ([]*repo.Notification, int, error)

func (*NotficationsDB) GetUnreadCount

func (n *NotficationsDB) GetUnreadCount() (int, error)

func (*NotficationsDB) Lock

func (m *NotficationsDB) Lock()

func (*NotficationsDB) MarkAllAsRead

func (n *NotficationsDB) MarkAllAsRead() error

func (*NotficationsDB) MarkAsRead

func (n *NotficationsDB) MarkAsRead(notifID string) error

func (*NotficationsDB) PrepareAndExecuteQuery

func (m *NotficationsDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*NotficationsDB) PrepareQuery

func (m *NotficationsDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*NotficationsDB) PutRecord

func (n *NotficationsDB) PutRecord(record *repo.Notification) error

func (*NotficationsDB) Unlock

func (m *NotficationsDB) Unlock()

type OfflineMessagesDB

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

func (*OfflineMessagesDB) BeginTransaction

func (m *OfflineMessagesDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*OfflineMessagesDB) DeleteMessage

func (o *OfflineMessagesDB) DeleteMessage(url string) error

func (*OfflineMessagesDB) ExecuteQuery

func (m *OfflineMessagesDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*OfflineMessagesDB) GetMessages

func (o *OfflineMessagesDB) GetMessages() (map[string][]byte, error)

func (*OfflineMessagesDB) Has

func (o *OfflineMessagesDB) Has(url string) bool

func (*OfflineMessagesDB) Lock

func (m *OfflineMessagesDB) Lock()

func (*OfflineMessagesDB) PrepareAndExecuteQuery

func (m *OfflineMessagesDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*OfflineMessagesDB) PrepareQuery

func (m *OfflineMessagesDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*OfflineMessagesDB) Put

func (o *OfflineMessagesDB) Put(url string) error

func (*OfflineMessagesDB) SetMessage

func (o *OfflineMessagesDB) SetMessage(url string, message []byte) error

func (*OfflineMessagesDB) Unlock

func (m *OfflineMessagesDB) Unlock()

type PointersDB

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

func (*PointersDB) BeginTransaction

func (m *PointersDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*PointersDB) Delete

func (p *PointersDB) Delete(id peer.ID) error

func (*PointersDB) DeleteAll

func (p *PointersDB) DeleteAll(purpose ipfs.Purpose) error

func (*PointersDB) ExecuteQuery

func (m *PointersDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*PointersDB) Get

func (p *PointersDB) Get(id peer.ID) (ipfs.Pointer, error)

func (*PointersDB) GetAll

func (p *PointersDB) GetAll() ([]ipfs.Pointer, error)

func (*PointersDB) GetByPurpose

func (p *PointersDB) GetByPurpose(purpose ipfs.Purpose) ([]ipfs.Pointer, error)

func (*PointersDB) Lock

func (m *PointersDB) Lock()

func (*PointersDB) PrepareAndExecuteQuery

func (m *PointersDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*PointersDB) PrepareQuery

func (m *PointersDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*PointersDB) Put

func (p *PointersDB) Put(pointer ipfs.Pointer) error

func (*PointersDB) Unlock

func (m *PointersDB) Unlock()

type PurchasesDB

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

func (*PurchasesDB) BeginTransaction

func (m *PurchasesDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*PurchasesDB) Count

func (p *PurchasesDB) Count() int

func (*PurchasesDB) Delete

func (p *PurchasesDB) Delete(orderID string) error

func (*PurchasesDB) ExecuteQuery

func (m *PurchasesDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*PurchasesDB) GetAll

func (p *PurchasesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Purchase, int, error)

func (*PurchasesDB) GetByOrderId

func (p *PurchasesDB) GetByOrderId(orderId string) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, bool, *repo.CurrencyCode, error)

func (*PurchasesDB) GetByPaymentAddress

func (p *PurchasesDB) GetByPaymentAddress(addr btc.Address) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, error)

func (*PurchasesDB) GetPurchasesForDisputeExpiryNotification

func (p *PurchasesDB) GetPurchasesForDisputeExpiryNotification() ([]*repo.PurchaseRecord, error)

func (*PurchasesDB) GetPurchasesForDisputeTimeoutNotification

func (p *PurchasesDB) GetPurchasesForDisputeTimeoutNotification() ([]*repo.PurchaseRecord, error)

GetPurchasesForDisputeTimeoutNotification returns []*PurchaseRecord including each record which needs Notifications to be generated.

func (*PurchasesDB) GetUnfunded

func (p *PurchasesDB) GetUnfunded() ([]repo.UnfundedOrder, error)

func (*PurchasesDB) Lock

func (m *PurchasesDB) Lock()

func (*PurchasesDB) MarkAsRead

func (p *PurchasesDB) MarkAsRead(orderID string) error

func (*PurchasesDB) MarkAsUnread

func (p *PurchasesDB) MarkAsUnread(orderID string) error

func (*PurchasesDB) PrepareAndExecuteQuery

func (m *PurchasesDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*PurchasesDB) PrepareQuery

func (m *PurchasesDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*PurchasesDB) Put

func (p *PurchasesDB) Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

func (*PurchasesDB) Unlock

func (m *PurchasesDB) Unlock()

func (*PurchasesDB) UpdateFunding

func (p *PurchasesDB) UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error

func (*PurchasesDB) UpdatePurchasesLastDisputeExpiryNotifiedAt

func (p *PurchasesDB) UpdatePurchasesLastDisputeExpiryNotifiedAt(purchases []*repo.PurchaseRecord) error

UpdatePurchasesLastDisputeExpiryNotifiedAt accepts []*repo.PurchaseRecord and updates each PurchaseRecord by their OrderID to the set LastDisputeExpiryNotifiedAt value. The update will be attempted atomically with a rollback attempted in the event of an error.

func (*PurchasesDB) UpdatePurchasesLastDisputeTimeoutNotifiedAt

func (p *PurchasesDB) UpdatePurchasesLastDisputeTimeoutNotifiedAt(purchases []*repo.PurchaseRecord) error

UpdatePurchasesLastDisputeTimeoutNotifiedAt accepts []*repo.PurchaseRecord and updates each PurchaseRecord by their OrderID to the set LastDisputeTimeoutNotifiedAt value. The update will be attempted atomically with a rollback attempted in the event of an error.

type SQLiteDatastore

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

func Create

func Create(repoPath, password string, testnet bool, coinType wallet.CoinType) (*SQLiteDatastore, error)

func NewSQLiteDatastore

func NewSQLiteDatastore(db *sql.DB, l *sync.Mutex, coinType wallet.CoinType) *SQLiteDatastore

func (*SQLiteDatastore) Cases

func (d *SQLiteDatastore) Cases() repo.CaseStore

func (*SQLiteDatastore) Chat

func (d *SQLiteDatastore) Chat() repo.ChatStore

func (*SQLiteDatastore) Close

func (d *SQLiteDatastore) Close()

func (*SQLiteDatastore) Config

func (d *SQLiteDatastore) Config() repo.Config

func (*SQLiteDatastore) Copy

func (d *SQLiteDatastore) Copy(dbPath string, password string) error

func (*SQLiteDatastore) Coupons

func (d *SQLiteDatastore) Coupons() repo.CouponStore

func (*SQLiteDatastore) DB

func (d *SQLiteDatastore) DB() *DB

func (*SQLiteDatastore) Followers

func (d *SQLiteDatastore) Followers() repo.FollowerStore

func (*SQLiteDatastore) Following

func (d *SQLiteDatastore) Following() repo.FollowingStore

func (*SQLiteDatastore) InitTables

func (s *SQLiteDatastore) InitTables(password string) error

func (*SQLiteDatastore) Inventory

func (d *SQLiteDatastore) Inventory() repo.InventoryStore

func (*SQLiteDatastore) Keys

func (d *SQLiteDatastore) Keys() wallet.Keys

func (*SQLiteDatastore) Messages

func (d *SQLiteDatastore) Messages() repo.MessageStore

Messages - return the messages datastore

func (*SQLiteDatastore) ModeratedStores

func (d *SQLiteDatastore) ModeratedStores() repo.ModeratedStore

func (*SQLiteDatastore) Notifications

func (d *SQLiteDatastore) Notifications() repo.NotificationStore

func (*SQLiteDatastore) OfflineMessages

func (d *SQLiteDatastore) OfflineMessages() repo.OfflineMessageStore

func (*SQLiteDatastore) Ping

func (d *SQLiteDatastore) Ping() error

func (*SQLiteDatastore) Pointers

func (d *SQLiteDatastore) Pointers() repo.PointerStore

func (*SQLiteDatastore) Purchases

func (d *SQLiteDatastore) Purchases() repo.PurchaseStore

func (*SQLiteDatastore) Sales

func (d *SQLiteDatastore) Sales() repo.SaleStore

func (*SQLiteDatastore) Settings

func (d *SQLiteDatastore) Settings() repo.ConfigurationStore

func (*SQLiteDatastore) Stxos

func (d *SQLiteDatastore) Stxos() wallet.Stxos

func (*SQLiteDatastore) TxMetadata

func (*SQLiteDatastore) Txns

func (d *SQLiteDatastore) Txns() wallet.Txns

func (*SQLiteDatastore) Utxos

func (d *SQLiteDatastore) Utxos() wallet.Utxos

func (*SQLiteDatastore) WatchedScripts

func (d *SQLiteDatastore) WatchedScripts() wallet.WatchedScripts

type SalesDB

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

func (*SalesDB) BeginTransaction

func (m *SalesDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*SalesDB) Count

func (s *SalesDB) Count() int

func (*SalesDB) Delete

func (s *SalesDB) Delete(orderID string) error

func (*SalesDB) ExecuteQuery

func (m *SalesDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*SalesDB) GetAll

func (s *SalesDB) GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]repo.Sale, int, error)

func (*SalesDB) GetByOrderId

func (s *SalesDB) GetByOrderId(orderId string) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, bool, *repo.CurrencyCode, error)

func (*SalesDB) GetByPaymentAddress

func (s *SalesDB) GetByPaymentAddress(addr btc.Address) (*pb.RicardianContract, pb.OrderState, bool, []*wallet.TransactionRecord, error)

func (*SalesDB) GetSalesForDisputeTimeoutNotification

func (s *SalesDB) GetSalesForDisputeTimeoutNotification() ([]*repo.SaleRecord, error)

GetSalesForDisputeTimeoutNotification returns []*SaleRecord including each record which needs Notifications to be generated.

func (*SalesDB) GetUnfunded

func (s *SalesDB) GetUnfunded() ([]repo.UnfundedOrder, error)

func (*SalesDB) Lock

func (m *SalesDB) Lock()

func (*SalesDB) MarkAsRead

func (s *SalesDB) MarkAsRead(orderID string) error

func (*SalesDB) MarkAsUnread

func (s *SalesDB) MarkAsUnread(orderID string) error

func (*SalesDB) PrepareAndExecuteQuery

func (m *SalesDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*SalesDB) PrepareQuery

func (m *SalesDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*SalesDB) Put

func (s *SalesDB) Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error

func (*SalesDB) Unlock

func (m *SalesDB) Unlock()

func (*SalesDB) UpdateFunding

func (s *SalesDB) UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error

func (*SalesDB) UpdateSalesLastDisputeTimeoutNotifiedAt

func (s *SalesDB) UpdateSalesLastDisputeTimeoutNotifiedAt(sales []*repo.SaleRecord) error

UpdateSalesLastDisputeTimeoutNotifiedAt accepts []*repo.SaleRecord and updates each SaleRecord by their OrderID to the set LastDisputeTimeoutNotifiedAt value. The update will be attempted atomically with a rollback attempted in the event of an error.

type SettingsDB

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

func (*SettingsDB) BeginTransaction

func (m *SettingsDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*SettingsDB) Delete

func (s *SettingsDB) Delete() error

Delete removes all settings from the database. It's a destructive action that should be used with care.

func (*SettingsDB) ExecuteQuery

func (m *SettingsDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*SettingsDB) Get

func (s *SettingsDB) Get() (repo.SettingsData, error)

func (*SettingsDB) Lock

func (m *SettingsDB) Lock()

func (*SettingsDB) PrepareAndExecuteQuery

func (m *SettingsDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*SettingsDB) PrepareQuery

func (m *SettingsDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*SettingsDB) Put

func (s *SettingsDB) Put(settings repo.SettingsData) error

func (*SettingsDB) Unlock

func (m *SettingsDB) Unlock()

func (*SettingsDB) Update

func (s *SettingsDB) Update(settings repo.SettingsData) error

type StxoDB

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

func (*StxoDB) BeginTransaction

func (m *StxoDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*StxoDB) Delete

func (s *StxoDB) Delete(stxo wallet.Stxo) error

func (*StxoDB) ExecuteQuery

func (m *StxoDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*StxoDB) GetAll

func (s *StxoDB) GetAll() ([]wallet.Stxo, error)

func (*StxoDB) Lock

func (m *StxoDB) Lock()

func (*StxoDB) PrepareAndExecuteQuery

func (m *StxoDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*StxoDB) PrepareQuery

func (m *StxoDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*StxoDB) Put

func (s *StxoDB) Put(stxo wallet.Stxo) error

func (*StxoDB) Unlock

func (m *StxoDB) Unlock()

type TxMetadataDB

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

func (*TxMetadataDB) BeginTransaction

func (m *TxMetadataDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*TxMetadataDB) Delete

func (t *TxMetadataDB) Delete(txid string) error

func (*TxMetadataDB) ExecuteQuery

func (m *TxMetadataDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*TxMetadataDB) Get

func (t *TxMetadataDB) Get(txid string) (repo.Metadata, error)

func (*TxMetadataDB) GetAll

func (t *TxMetadataDB) GetAll() (map[string]repo.Metadata, error)

func (*TxMetadataDB) Lock

func (m *TxMetadataDB) Lock()

func (*TxMetadataDB) PrepareAndExecuteQuery

func (m *TxMetadataDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*TxMetadataDB) PrepareQuery

func (m *TxMetadataDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*TxMetadataDB) Put

func (t *TxMetadataDB) Put(m repo.Metadata) error

func (*TxMetadataDB) Unlock

func (m *TxMetadataDB) Unlock()

type TxnsDB

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

func (*TxnsDB) BeginTransaction

func (m *TxnsDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*TxnsDB) Delete

func (t *TxnsDB) Delete(txid *chainhash.Hash) error

func (*TxnsDB) ExecuteQuery

func (m *TxnsDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*TxnsDB) Get

func (t *TxnsDB) Get(txid chainhash.Hash) (wallet.Txn, error)

func (*TxnsDB) GetAll

func (t *TxnsDB) GetAll(includeWatchOnly bool) ([]wallet.Txn, error)

func (*TxnsDB) Lock

func (m *TxnsDB) Lock()

func (*TxnsDB) PrepareAndExecuteQuery

func (m *TxnsDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*TxnsDB) PrepareQuery

func (m *TxnsDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*TxnsDB) Put

func (t *TxnsDB) Put(raw []byte, txid, value string, height int, timestamp time.Time, watchOnly bool) error

func (*TxnsDB) Unlock

func (m *TxnsDB) Unlock()

func (*TxnsDB) UpdateHeight

func (t *TxnsDB) UpdateHeight(txid chainhash.Hash, height int, timestamp time.Time) error

type UtxoDB

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

func (*UtxoDB) BeginTransaction

func (m *UtxoDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*UtxoDB) Delete

func (u *UtxoDB) Delete(utxo wallet.Utxo) error

func (*UtxoDB) ExecuteQuery

func (m *UtxoDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*UtxoDB) GetAll

func (u *UtxoDB) GetAll() ([]wallet.Utxo, error)

func (*UtxoDB) Lock

func (m *UtxoDB) Lock()

func (*UtxoDB) PrepareAndExecuteQuery

func (m *UtxoDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*UtxoDB) PrepareQuery

func (m *UtxoDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*UtxoDB) Put

func (u *UtxoDB) Put(utxo wallet.Utxo) error

func (*UtxoDB) SetWatchOnly

func (u *UtxoDB) SetWatchOnly(utxo wallet.Utxo) error

func (*UtxoDB) Unlock

func (m *UtxoDB) Unlock()

type WatchedScriptsDB

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

func (*WatchedScriptsDB) BeginTransaction

func (m *WatchedScriptsDB) BeginTransaction() (*sql.Tx, error)

Begin returns a *sql.Tx for transactional query support

func (*WatchedScriptsDB) Delete

func (w *WatchedScriptsDB) Delete(scriptPubKey []byte) error

func (*WatchedScriptsDB) ExecuteQuery

func (m *WatchedScriptsDB) ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

ExecuteQuery returns the *sql.Result for the executed query without returning Rows

func (*WatchedScriptsDB) GetAll

func (w *WatchedScriptsDB) GetAll() ([][]byte, error)

func (*WatchedScriptsDB) Lock

func (m *WatchedScriptsDB) Lock()

func (*WatchedScriptsDB) PrepareAndExecuteQuery

func (m *WatchedScriptsDB) PrepareAndExecuteQuery(query string, args ...interface{}) (*sql.Rows, error)

PrepareAndExecuteQuery returns the resulting *sql.Rows for the executed query

func (*WatchedScriptsDB) PrepareQuery

func (m *WatchedScriptsDB) PrepareQuery(query string) (*sql.Stmt, error)

PrepareQuery returns a *sql.Stmt to the wrapped DB

func (*WatchedScriptsDB) Put

func (w *WatchedScriptsDB) Put(scriptPubKey []byte) error

func (*WatchedScriptsDB) PutAll

func (w *WatchedScriptsDB) PutAll(scriptPubKeys [][]byte) error

func (*WatchedScriptsDB) Unlock

func (m *WatchedScriptsDB) Unlock()

Jump to

Keyboard shortcuts

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