Documentation
¶
Index ¶
- type Addresses
- type All
- type Contacts
- func (r *Contacts) Create(ctx context.Context, newContact contactsmodels.NewContact) (*contactsmodels.Contact, error)
- func (r *Contacts) Delete(ctx context.Context, userID, paymail string) error
- func (r *Contacts) DeleteByID(ctx context.Context, contactID uint) error
- func (r *Contacts) Find(ctx context.Context, userID, paymail string) (*contactsmodels.Contact, error)
- func (r *Contacts) FindByID(ctx context.Context, contactID uint) (*contactsmodels.Contact, error)
- func (r *Contacts) PaginatedForAdmin(ctx context.Context, page filter.Page, conditions map[string]interface{}) (*models.PagedResult[contactsmodels.Contact], error)
- func (r *Contacts) PaginatedForUser(ctx context.Context, userID string, page filter.Page, ...) (*models.PagedResult[contactsmodels.Contact], error)
- func (r *Contacts) Update(ctx context.Context, contact contactsmodels.NewContact) (*contactsmodels.Contact, error)
- func (r *Contacts) UpdateByID(ctx context.Context, contactID uint, fullName string) (*contactsmodels.Contact, error)
- func (r *Contacts) UpdateStatus(ctx context.Context, userID, paymail, status string) error
- func (r *Contacts) UpdateStatusByID(ctx context.Context, contactID uint, status string) (*contactsmodels.Contact, error)
- type Data
- type Operations
- type Outputs
- type Paymails
- func (p *Paymails) Create(ctx context.Context, newPaymail *paymailsmodels.NewPaymail) (*paymailsmodels.Paymail, error)
- func (p *Paymails) Find(ctx context.Context, alias, domain string) (*paymailsmodels.Paymail, error)
- func (p *Paymails) FindForUser(ctx context.Context, alias, domain, userID string) (*paymailsmodels.Paymail, error)
- func (p *Paymails) GetDefault(ctx context.Context, userID string) (*paymailsmodels.Paymail, error)
- type Transactions
- func (t *Transactions) FindTransactionInputSources(ctx context.Context, sourceTXIDs ...string) (beef.TxQueryResultSlice, error)
- func (t *Transactions) GetTransaction(ctx context.Context, txID string) (transaction *txmodels.TrackedTransaction, err error)
- func (t *Transactions) HasTransactionInputSources(ctx context.Context, sourceTXIDs ...string) (bool, error)
- func (t *Transactions) UpdateTransaction(ctx context.Context, trackedTx *txmodels.TrackedTransaction) error
- type Users
- func (u *Users) Create(ctx context.Context, newUser *usersmodels.NewUser) (*usersmodels.User, error)
- func (u *Users) Delete(ctx context.Context, userID string) error
- func (u *Users) Exists(ctx context.Context, userID string) (bool, error)
- func (u *Users) Get(ctx context.Context, userID string) (*usersmodels.User, error)
- func (u *Users) GetBalance(ctx context.Context, userID string, bucket bucket.Name) (bsv.Satoshis, error)
- func (u *Users) GetIDByPubKey(ctx context.Context, pubKey string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addresses ¶
type Addresses struct {
// contains filtered or unexported fields
}
Addresses is a repository for addresses.
func NewAddressesRepo ¶
NewAddressesRepo creates a new repository for addresses.
func (*Addresses) Create ¶
func (r *Addresses) Create(ctx context.Context, newAddress *addressesmodels.NewAddress) error
Create adds a new address to the database.
type All ¶
type All struct {
Addresses *Addresses
Paymails *Paymails
Operations *Operations
Transactions *Transactions
Users *Users
Outputs *Outputs
Data *Data
Contacts *Contacts
}
All holds all repositories.
func NewRepositories ¶
NewRepositories creates a new holder for all repositories.
type Contacts ¶
type Contacts struct {
// contains filtered or unexported fields
}
Contacts is a repository for contacts.
func NewContactsRepo ¶
NewContactsRepo creates a new repository for addresses.
func (*Contacts) Create ¶
func (r *Contacts) Create(ctx context.Context, newContact contactsmodels.NewContact) (*contactsmodels.Contact, error)
Create adds a new contact to the database.
func (*Contacts) DeleteByID ¶
DeleteByID removes a contact from the database by its ID.
func (*Contacts) Find ¶
func (r *Contacts) Find(ctx context.Context, userID, paymail string) (*contactsmodels.Contact, error)
Find retrieves a contact from the database.
func (*Contacts) PaginatedForAdmin ¶
func (r *Contacts) PaginatedForAdmin(ctx context.Context, page filter.Page, conditions map[string]interface{}) (*models.PagedResult[contactsmodels.Contact], error)
PaginatedForAdmin retrieves contacts for admin and the provided paging options and db conditions.
func (*Contacts) PaginatedForUser ¶
func (r *Contacts) PaginatedForUser(ctx context.Context, userID string, page filter.Page, conditions map[string]interface{}) (*models.PagedResult[contactsmodels.Contact], error)
PaginatedForUser retrieves contacts for user and the provided paging options and db conditions.
func (*Contacts) Update ¶
func (r *Contacts) Update(ctx context.Context, contact contactsmodels.NewContact) (*contactsmodels.Contact, error)
Update updates contact in database.
func (*Contacts) UpdateByID ¶
func (r *Contacts) UpdateByID(ctx context.Context, contactID uint, fullName string) (*contactsmodels.Contact, error)
UpdateByID updates contact full name using its ID.
func (*Contacts) UpdateStatus ¶
UpdateStatus updates contact status in database.
func (*Contacts) UpdateStatusByID ¶
func (r *Contacts) UpdateStatusByID(ctx context.Context, contactID uint, status string) (*contactsmodels.Contact, error)
UpdateStatusByID updates contact status using its ID.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is a repository for data.
func NewDataRepo ¶
NewDataRepo creates a new instance of the data repository.
func (*Data) FindForUser ¶
FindForUser returns the data by outpoint for a specific user.
type Operations ¶
type Operations struct {
// contains filtered or unexported fields
}
Operations is a repository for operations.
func NewOperationsRepo ¶
func NewOperationsRepo(db *gorm.DB) *Operations
NewOperationsRepo creates a new repository for operations.
func (*Operations) PaginatedForUser ¶
func (o *Operations) PaginatedForUser(ctx context.Context, userID string, page filter.Page) (*models.PagedResult[operationsmodels.Operation], error)
PaginatedForUser returns operations for a user based on userID and the provided paging options.
func (*Operations) SaveAll ¶
func (o *Operations) SaveAll(ctx context.Context, operations iter.Seq[*txmodels.NewOperation]) error
SaveAll saves operations to the database.
type Outputs ¶
type Outputs struct {
// contains filtered or unexported fields
}
Outputs is a repository for outputs.
func NewOutputsRepo ¶
NewOutputsRepo creates a new repository for outputs.
type Paymails ¶
type Paymails struct {
// contains filtered or unexported fields
}
Paymails is a repository for paymails.
func NewPaymailsRepo ¶
NewPaymailsRepo creates a new repository for paymails.
func (*Paymails) Create ¶
func (p *Paymails) Create(ctx context.Context, newPaymail *paymailsmodels.NewPaymail) (*paymailsmodels.Paymail, error)
Create adds a new paymail to the database.
func (*Paymails) FindForUser ¶
func (p *Paymails) FindForUser(ctx context.Context, alias, domain, userID string) (*paymailsmodels.Paymail, error)
FindForUser returns a paymail by alias and domain for given user.
func (*Paymails) GetDefault ¶
GetDefault returns a default paymail for user.
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
Transactions provides database operations for managing transactions.
func NewTransactions ¶
func NewTransactions(db *gorm.DB) *Transactions
NewTransactions creates a new Transactions repository. It initializes a database-backed service for querying and managing transactions.
func (*Transactions) FindTransactionInputSources ¶
func (t *Transactions) FindTransactionInputSources(ctx context.Context, sourceTXIDs ...string) (beef.TxQueryResultSlice, error)
FindTransactionInputSources retrieves the full ancestry of input sources for a given transaction. It recursively traces input sources in batches to minimize database queries.
func (*Transactions) GetTransaction ¶
func (t *Transactions) GetTransaction(ctx context.Context, txID string) (transaction *txmodels.TrackedTransaction, err error)
GetTransaction retrieves the tracked transaction with the given transaction ID.
func (*Transactions) HasTransactionInputSources ¶
func (t *Transactions) HasTransactionInputSources(ctx context.Context, sourceTXIDs ...string) (bool, error)
HasTransactionInputSources checks if all the provided input source transaction IDs exist in the database. If all of them are found, the transaction data can be serialized into Raw HEX format. Otherwise, serialization should be done using the BEEFHex format.
func (*Transactions) UpdateTransaction ¶
func (t *Transactions) UpdateTransaction(ctx context.Context, trackedTx *txmodels.TrackedTransaction) error
UpdateTransaction updates the tracked transaction with the given transaction data and makes cleanup of the input sources.
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users is a repository for users.
func NewUsersRepo ¶
NewUsersRepo creates a new repository for users.
func (*Users) Create ¶
func (u *Users) Create(ctx context.Context, newUser *usersmodels.NewUser) (*usersmodels.User, error)
Create saves new user to the database.
func (*Users) Delete ¶
Delete deletes user with userID and deletes their associated paymails, addresses, operations and tracked outputs
func (*Users) Get ¶
Get returns a user by its id with preloaded paymail slist. If the user does not exist, it returns error.