filter

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKeyFilter added in v0.28.0

type AccessKeyFilter struct {
	ModelFilter `json:",inline"`

	// RevokedRange specifies the time range when a record was revoked.
	RevokedRange *TimeRange `json:"revokedRange,omitempty"`
}

AccessKeyFilter is a struct for handling request parameters for destination search requests

func (*AccessKeyFilter) ToDbConditions added in v0.28.0

func (d *AccessKeyFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type AdminAccessKeyFilter added in v0.28.0

type AdminAccessKeyFilter struct {
	AccessKeyFilter `json:",inline"`

	XpubID *string `json:"xpubId,omitempty"`
}

AdminAccessKeyFilter wraps the AccessKeyFilter providing additional fields for admin access key search requests

func (*AdminAccessKeyFilter) ToDbConditions added in v0.28.0

func (d *AdminAccessKeyFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type AdminCountAccessKeys added in v0.28.0

type AdminCountAccessKeys = ConditionsModel[AdminAccessKeyFilter]

AdminCountAccessKeys is a model for handling counting filtered transactions

type AdminCountPaymails added in v0.28.0

type AdminCountPaymails = ConditionsModel[AdminPaymailFilter]

AdminCountPaymails is a model for handling counting filtered paymails

type AdminCountUtxos added in v0.28.0

type AdminCountUtxos = ConditionsModel[AdminUtxoFilter]

AdminCountUtxos is a model for handling counting filtered UTXOs

type AdminPaymailFilter added in v0.28.0

type AdminPaymailFilter struct {
	ModelFilter `json:",inline"`

	ID         *string `json:"id,omitempty" example:"ffb86c103d17d87c15aaf080aab6be5415c9fa885309a79b04c9910e39f2b542"`
	XpubID     *string `json:"xpubId,omitempty" example:"79f90a6bab0a44402fc64828af820e9465645658aea2d138c5205b88e6dabd00"`
	Alias      *string `json:"alias,omitempty" example:"alice"`
	Domain     *string `json:"domain,omitempty" example:"example.com"`
	PublicName *string `json:"publicName,omitempty" example:"Alice"`
}

AdminPaymailFilter is a struct for handling request parameters for paymail_addresses search requests

func (*AdminPaymailFilter) ToDbConditions added in v0.28.0

func (d *AdminPaymailFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type AdminSearchAccessKeys added in v0.28.0

type AdminSearchAccessKeys = SearchModel[AdminAccessKeyFilter]

AdminSearchAccessKeys is a model for handling searching with filters and metadata

type AdminSearchPaymails added in v0.28.0

type AdminSearchPaymails = SearchModel[AdminPaymailFilter]

AdminSearchPaymails is a model for handling searching with filters and metadata

type AdminSearchUtxos added in v0.28.0

type AdminSearchUtxos = SearchModel[AdminUtxoFilter]

AdminSearchUtxos is a model for handling searching with filters and metadata

type AdminUtxoFilter added in v0.28.0

type AdminUtxoFilter struct {
	UtxoFilter `json:",inline"`

	XpubID *string `json:"xpubId,omitempty"`
}

AdminUtxoFilter wraps the UtxoFilter providing additional fields for admin utxo search requests

func (*AdminUtxoFilter) ToDbConditions added in v0.28.0

func (d *AdminUtxoFilter) ToDbConditions() (map[string]interface{}, error)

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type ConditionsModel added in v0.28.0

type ConditionsModel[TFilter any] struct {
	// Custom conditions used for filtering the search results. Every field within the object is optional.
	Conditions *TFilter `json:"conditions"`
	// Accepts a JSON object for embedding custom metadata, enabling arbitrary additional information to be associated with the resource
	Metadata map[string]interface{} `json:"metadata,omitempty" swaggertype:"object,string" example:"key:value,key2:value2"`
}

ConditionsModel is a generic model for handling conditions with metadata

type ContactFilter added in v0.28.0

type ContactFilter struct {
	ModelFilter `json:",inline"`
	ID          *string `json:"id" example:"ffdbe74e-0700-4710-aac5-611a1f877c7f"`
	FullName    *string `json:"fullName" example:"Alice"`
	Paymail     *string `json:"paymail" example:"alice@example.com"`
	PubKey      *string `json:"pubKey" example:"0334f01ecb971e93db179e6fb320cd1466beb0c1ec6c1c6a37aa6cb02e53d5dd1a"`
	Status      *string `json:"status,omitempty" enums:"unconfirmed,awaiting,confirmed,rejected"`
}

ContactFilter is a struct for handling request parameters for contact search requests

func (*ContactFilter) ToDbConditions added in v0.28.0

func (d *ContactFilter) ToDbConditions() (map[string]interface{}, error)

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type CountAccessKeys added in v0.28.0

type CountAccessKeys = ConditionsModel[AccessKeyFilter]

CountAccessKeys is a model for handling counting filtered transactions

type CountDestinations added in v0.28.0

type CountDestinations = ConditionsModel[DestinationFilter]

CountDestinations is a model for handling counting filtered destinations

type CountTransactions added in v0.28.0

type CountTransactions = ConditionsModel[TransactionFilter]

CountTransactions is a model for handling counting filtered transactions

type CountUtxos added in v0.28.0

type CountUtxos = ConditionsModel[UtxoFilter]

CountUtxos is a model for handling counting filtered UTXOs

type CountXpubs added in v0.28.0

type CountXpubs = ConditionsModel[XpubFilter]

CountXpubs is a model for handling counting filtered xPubs

type DestinationFilter

type DestinationFilter struct {
	ModelFilter   `json:",inline"`
	LockingScript *string `json:"lockingScript,omitempty" example:"76a9147b05764a97f3b4b981471492aa703b188e45979b88ac"`
	Address       *string `json:"address,omitempty" example:"1CDUf7CKu8ocTTkhcYUbq75t14Ft168K65"`
	DraftID       *string `json:"draftId,omitempty" example:"b356f7fa00cd3f20cce6c21d704cd13e871d28d714a5ebd0532f5a0e0cde63f7"`
}

DestinationFilter is a struct for handling request parameters for destination search requests

func (*DestinationFilter) ToDbConditions

func (d *DestinationFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type ModelFilter

type ModelFilter struct {
	// IncludeDeleted is a flag whether or not to include deleted items in the search results
	IncludeDeleted *bool `json:"includeDeleted,omitempty" swaggertype:"boolean" default:"false" example:"true"`

	// CreatedRange specifies the time range when a record was created.
	CreatedRange *TimeRange `json:"createdRange,omitempty"`

	// UpdatedRange specifies the time range when a record was updated.
	UpdatedRange *TimeRange `json:"updatedRange,omitempty"`
}

ModelFilter is a common model filter that contains common fields for all model filters.

func (*ModelFilter) ToDbConditions

func (mf *ModelFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type QueryParams added in v0.28.0

type QueryParams struct {
	Page          int    `json:"page,omitempty"`
	PageSize      int    `json:"page_size,omitempty"`
	OrderByField  string `json:"order_by_field,omitempty"`
	SortDirection string `json:"sort_direction,omitempty"`
}

QueryParams object to use when limiting and sorting database query results

func DefaultQueryParams added in v0.28.0

func DefaultQueryParams() *QueryParams

DefaultQueryParams will return the default query parameters

type SearchAccessKeys added in v0.28.0

type SearchAccessKeys = SearchModel[AccessKeyFilter]

SearchAccessKeys is a model for handling searching with filters and metadata

type SearchContacts added in v0.28.0

type SearchContacts = SearchModel[ContactFilter]

SearchContacts is a model for handling searching with filters and metadata

type SearchDestinations added in v0.28.0

type SearchDestinations = SearchModel[DestinationFilter]

SearchDestinations is a model for handling searching with filters and metadata

type SearchModel added in v0.28.0

type SearchModel[TFilter any] struct {
	ConditionsModel[TFilter]

	// Pagination and sorting options to streamline data exploration and analysis
	QueryParams *QueryParams `` /* 131-byte string literal not displayed */
}

SearchModel is a generic model for handling searching with filters and metadata

func (*SearchModel[TFilter]) DefaultsIfNil added in v0.28.0

func (sm *SearchModel[TFilter]) DefaultsIfNil()

DefaultsIfNil fills empty but neccessary fields with default values

type SearchTransactions added in v0.28.0

type SearchTransactions = SearchModel[TransactionFilter]

SearchTransactions is a model for handling searching with filters and metadata

type SearchUtxos added in v0.28.0

type SearchUtxos = SearchModel[UtxoFilter]

SearchUtxos is a model for handling searching with filters and metadata

type SearchXpubs added in v0.28.0

type SearchXpubs = SearchModel[XpubFilter]

SearchXpubs is a model for handling searching with filters and metadata

type TimeRange

type TimeRange struct {
	// From specifies the start time of the range. It's optional and can be nil.
	From *time.Time `json:"from,omitempty" example:"2024-02-26T11:01:28Z"`
	// To specifies the end time of the range. It's optional and can be nil.
	To *time.Time `json:"to,omitempty" example:"2024-02-26T11:01:28Z"`
}

TimeRange defines a range between two points in time.

func (*TimeRange) ToDbConditions

func (tr *TimeRange) ToDbConditions() map[string]interface{}

ToDbConditions converts the TimeRange to a set of database query conditions. Returns nil if both From and To are nil or zero, indicating no conditions.

type TransactionFilter

type TransactionFilter struct {
	ModelFilter     `json:",inline"`
	Hex             *string `json:"hex,omitempty"`
	BlockHash       *string `json:"blockHash,omitempty" example:"0000000000000000031928c28075a82d7a00c2c90b489d1d66dc0afa3f8d26f8"`
	BlockHeight     *uint64 `json:"blockHeight,omitempty" example:"839376"`
	Fee             *uint64 `json:"fee,omitempty" example:"1"`
	NumberOfInputs  *uint32 `json:"numberOfInputs,omitempty" example:"1"`
	NumberOfOutputs *uint32 `json:"numberOfOutputs,omitempty" example:"2"`
	DraftID         *string `json:"draftId,omitempty" example:"d425432e0d10a46af1ec6d00f380e9581ebf7907f3486572b3cd561a4c326e14"`
	TotalValue      *uint64 `json:"totalValue,omitempty" example:"100000000"`
	Status          *string `` /* 204-byte string literal not displayed */
}

TransactionFilter is a struct for handling request parameters for transactions search requests

func (*TransactionFilter) ToDbConditions

func (d *TransactionFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type UtxoFilter added in v0.28.0

type UtxoFilter struct {
	ModelFilter `json:",inline"`

	TransactionID *string `json:"transactionId,omitempty" example:"5e17858ea0ca4155827754ba82bdcfcce108d5bb5b47fbb3aa54bd14540683c6"`
	OutputIndex   *uint32 `json:"outputIndex,omitempty" example:"0"`

	ID            *string    `json:"id,omitempty" example:"fe4cbfee0258aa589cbc79963f7c204061fd67d987e32ee5049aa90ce14658ee"`
	Satoshis      *uint64    `json:"satoshis,omitempty" example:"1"`
	ScriptPubKey  *string    `json:"scriptPubKey,omitempty" example:"76a914a5f271385e75f57bcd9092592dede812f8c466d088ac"`
	Type          *string    `json:"type,omitempty" enums:"pubkey,pubkeyhash,nulldata,multisig,nonstandard,scripthash,metanet,token_stas,token_sensible"`
	DraftID       *string    `json:"draftId,omitempty" example:"89419d4c7c50810bfe5ff9df9ad5074b749959423782dc91a30f1058b9ad7ef7"`
	ReservedRange *TimeRange `json:"reservedRange,omitempty"` // ReservedRange specifies the time range when a UTXO was reserved.
	SpendingTxID  *string    `json:"spendingTxId,omitempty" example:"11a7746489a70e9c0170601c2be65558455317a984194eb2791b637f59f8cd6e"`
}

UtxoFilter is a struct for handling request parameters for utxo search requests

func (*UtxoFilter) ToDbConditions added in v0.28.0

func (d *UtxoFilter) ToDbConditions() (map[string]interface{}, error)

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

type XpubFilter added in v0.28.0

type XpubFilter struct {
	ModelFilter `json:",inline"`

	ID             *string `json:"id,omitempty" example:"00b953624f78004a4c727cd28557475d5233c15f17aef545106639f4d71b712d"`
	CurrentBalance *uint64 `json:"currentBalance,omitempty" example:"1000"`
}

XpubFilter is a struct for handling request parameters for utxo search requests

func (*XpubFilter) ToDbConditions added in v0.28.0

func (d *XpubFilter) ToDbConditions() map[string]interface{}

ToDbConditions converts filter fields to the datastore conditions using gorm naming strategy

Jump to

Keyboard shortcuts

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