mock

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilPtr      = errors.New("destination pointer is nil")
	ErrUnknownType = errors.New("unknown type for conversion: reflection required")
)

Functions

func GetComplianceAuditLog added in v1.1.0

func GetComplianceAuditLog(includeChangeNotes bool, signIt bool) (model *models.ComplianceAuditLog)

Returns a sample ComplianceAuditLog. ChangeNotes is optional, as is signing it (with a fake signature which will not validate) before returning.

func GetSampleAPIKey added in v1.1.0

func GetSampleAPIKey(includeNulls bool) (model *models.APIKey)

Returns a sample APIKey. Can include or exclude any `NullType` types. The client id and secret will be random ULID strings.

func GetSampleAccount added in v1.1.0

func GetSampleAccount(includeNulls bool, addIvms101 bool, addCrypto bool) (account *models.Account)

Returns a sample Account. Can add the IVMS101 and CryptoAddresses and include or exclude `NullType` values. `zeroID` returns the model with a zeroed ULID.

func GetSampleContact added in v1.1.0

func GetSampleContact(email string) (model *models.Contact)

Returns a sample Contact.

func GetSampleCounterparty added in v1.1.0

func GetSampleCounterparty(includeNulls bool, includeContacts bool) (model *models.Counterparty)

Returns a sample Counterparty. This counterparty will be unique, using it's ID for the CommonName and Endpoint ("ULID_STRING.sample.example.com").

func GetSampleCryptoAddress added in v1.1.0

func GetSampleCryptoAddress(accountId ulid.ULID) (account *models.CryptoAddress)

Returns a sample CryptoAddress for the account ID provided. The crypto and travel addresses will be a random ULID strings and the network is "BTC".

func GetSamplePermission added in v1.1.0

func GetSamplePermission(id int64) (model *models.Permission)

Returns a sample Permission.

func GetSampleResetPasswordLink(includeNulls bool) (model *models.ResetPasswordLink)

Returns a sample ResetPasswordLink. Can include or exclude any `NullType` types.

func GetSampleRole added in v1.1.0

func GetSampleRole(id int64, includePermissions bool) (model *models.Role)

Returns a sample Role. Can include sample Permissions with it.

func GetSampleSecureEnvelope added in v1.1.0

func GetSampleSecureEnvelope(includeNulls bool, includeTransaction bool) (model *models.SecureEnvelope)

Returns a sample SecureEnvelope.

func GetSampleSunrise added in v1.1.0

func GetSampleSunrise(includeNulls bool) (model *models.Sunrise)

Returns a sample Sunrise. It won't have a signature unless includeNulls is true, and the email will be unique on the message ID.

func GetSampleTransaction added in v1.1.0

func GetSampleTransaction(includeNulls bool, includeEnvelopes bool, archived bool) (model *models.Transaction)

Returns a sample Transaction. The counterparty, beneficiary, originator, and crypto addresses are unique using the ID of the returned model.

func GetSampleUser added in v1.1.0

func GetSampleUser(includeNulls bool) (model *models.User)

Returns a sample User. Can include or exclude any `NullType` types. `zeroID` returns the model with a zeroed ULID.

Types

type MockScanner added in v1.1.0

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

MockScanner allows testing `Scan` interfaces for models. You can add an error to return or the data items you wish to scan into a model using `SetError()` or `SetData()`.

func (*MockScanner) AssertNotScanned added in v1.1.0

func (m *MockScanner) AssertNotScanned(t testing.TB, expected int)

Assert that the expected number of `data` items were *not* scanned (ignored/nil).

func (*MockScanner) AssertScanned added in v1.1.0

func (m *MockScanner) AssertScanned(t testing.TB, expected int)

Assert that the expected number of `data` items were scanned successfully.

func (*MockScanner) Log added in v1.1.0

func (m *MockScanner) Log(t testing.TB)

Logs any test log messages that were recorded during the test; then clears the log.

func (*MockScanner) Reset added in v1.1.0

func (m *MockScanner) Reset()

Resets the MockScanner to it's original state.

func (*MockScanner) Scan added in v1.1.0

func (m *MockScanner) Scan(dest ...any) (err error)

Scan will return an error if set, otherwise it will check that the lengths of `dest` and the `data` are equal and then attempt to scan each `data` item into the `dest` item with the same index, returning any errors.

func (*MockScanner) SetData added in v1.1.0

func (m *MockScanner) SetData(data []any)

Sets data to be scanned into the destinations given when `Scan()` is called. SetData will panic if `err` is already set.

func (*MockScanner) SetError added in v1.1.0

func (m *MockScanner) SetError(err error)

Sets an error to be returned from the scanner when `Scan()` is called. SetError will panic if `data` is already set.

type PreparedTransaction

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

func (*PreparedTransaction) AddCounterparty

func (p *PreparedTransaction) AddCounterparty(model *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnAddCounterparty()".

func (*PreparedTransaction) AddEnvelope

Calls the callback previously set with "OnAddEnvelope()".

func (*PreparedTransaction) AssertCalls added in v1.1.0

func (p *PreparedTransaction) AssertCalls(t testing.TB, method string, expected int)

Assert that the expected number of calls were made to the given method.

func (*PreparedTransaction) AssertCommit added in v1.1.0

func (p *PreparedTransaction) AssertCommit(t testing.TB)

Assert that Commit has been called on the transaction without rollback.

func (*PreparedTransaction) AssertNoCommit added in v1.1.0

func (p *PreparedTransaction) AssertNoCommit(t testing.TB)

Assert that Commit has not been called on the transaction.

func (*PreparedTransaction) AssertNoRollback added in v1.1.0

func (p *PreparedTransaction) AssertNoRollback(t testing.TB)

Assert that Rollback has not been called on the transaction.

func (*PreparedTransaction) AssertRollback added in v1.1.0

func (p *PreparedTransaction) AssertRollback(t testing.TB)

Assert that Rollback has been called on the transaction without commit.

func (*PreparedTransaction) Commit

func (p *PreparedTransaction) Commit() error

Calls the callback previously set with "OnCommit()". If no callback is set, it will "commit" the transaction.

func (*PreparedTransaction) CreateSunrise added in v1.1.0

func (p *PreparedTransaction) CreateSunrise(sunrise *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateSunrise()".

func (*PreparedTransaction) Created

func (p *PreparedTransaction) Created() bool

Calls the callback previously set with "OnCreated()".

func (*PreparedTransaction) Fetch

Calls the callback previously set with "OnFetch()".

func (*PreparedTransaction) LookupCounterparty added in v1.1.0

func (p *PreparedTransaction) LookupCounterparty(field, value string) (*models.Counterparty, error)

Calls the callback previously set with "OnLookupCounterparty()".

func (*PreparedTransaction) OnAddCounterparty added in v1.1.0

func (p *PreparedTransaction) OnAddCounterparty(fn func(*models.Counterparty, *models.ComplianceAuditLog) error)

Sets a callback for when "AddCounterparty()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnAddEnvelope added in v1.1.0

Sets a callback for when "AddEnvelope()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnCommit added in v1.1.0

func (p *PreparedTransaction) OnCommit(fn func() error)

Sets a callback for when "Commit()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnCreateSunrise added in v1.1.0

func (p *PreparedTransaction) OnCreateSunrise(fn func(sunrise *models.Sunrise, log *models.ComplianceAuditLog) error)

Sets a callback for when "CreateSunrise()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnCreated added in v1.1.0

func (p *PreparedTransaction) OnCreated(fn func() bool)

Sets a callback for when "Created()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnFetch added in v1.1.0

func (p *PreparedTransaction) OnFetch(fn func() (*models.Transaction, error))

Sets a callback for when "Fetch()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnLookupCounterparty added in v1.1.0

func (p *PreparedTransaction) OnLookupCounterparty(fn func(field, value string) (*models.Counterparty, error))

Sets a callback for when "LookupCounterparty()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnRollback added in v1.1.0

func (p *PreparedTransaction) OnRollback(fn func() error)

Sets a callback for when "Rollback()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnUpdate added in v1.1.0

Sets a callback for when "Update()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnUpdateCounterparty added in v1.1.0

func (p *PreparedTransaction) OnUpdateCounterparty(fn func(counterparty *models.Counterparty, log *models.ComplianceAuditLog) error)

Sets a callback for when "UpdateCounterparty()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnUpdateSunrise added in v1.1.0

func (p *PreparedTransaction) OnUpdateSunrise(fn func(sunrise *models.Sunrise, log *models.ComplianceAuditLog) error)

Sets a callback for when "UpdateSunrise()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) OnUpdateSunriseStatus added in v1.1.0

func (p *PreparedTransaction) OnUpdateSunriseStatus(fn func(id uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error)

Sets a callback for when "UpdateSunriseStatus()" is called on the mock PreparedTransaction.

func (*PreparedTransaction) Reset added in v1.1.0

func (p *PreparedTransaction) Reset()

Reset all the calls and callbacks in the PreparedTransaction, if you don't want to create a new one.

func (*PreparedTransaction) Rollback

func (p *PreparedTransaction) Rollback() error

Calls the callback previously set with "OnRollback()". If no callback is set, it will "rollback" the transaction.

func (*PreparedTransaction) Update

Calls the callback previously set with "OnUpdate()".

func (*PreparedTransaction) UpdateCounterparty added in v1.1.0

func (p *PreparedTransaction) UpdateCounterparty(counterparty *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateCounterparty()".

func (*PreparedTransaction) UpdateSunrise added in v1.1.0

func (p *PreparedTransaction) UpdateSunrise(sunrise *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateSunrise()".

func (*PreparedTransaction) UpdateSunriseStatus added in v1.1.0

func (p *PreparedTransaction) UpdateSunriseStatus(id uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateSunriseStatus()".

type Store

type Store struct {
	OnClose                          func() error
	OnBegin                          func(context.Context, *sql.TxOptions) (txn.Txn, error)
	OnListTransactions               func(ctx context.Context, in *models.TransactionPageInfo) (*models.TransactionPage, error)
	OnCreateTransaction              func(ctx context.Context, in *models.Transaction, log *models.ComplianceAuditLog) error
	OnRetrieveTransaction            func(ctx context.Context, id uuid.UUID) (*models.Transaction, error)
	OnUpdateTransaction              func(ctx context.Context, in *models.Transaction, log *models.ComplianceAuditLog) error
	OnDeleteTransaction              func(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error
	OnArchiveTransaction             func(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error
	OnUnarchiveTransaction           func(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error
	OnCountTransactions              func(ctx context.Context) (*models.TransactionCounts, error)
	OnPrepareTransaction             func(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) (models.PreparedTransaction, error)
	OnTransactionState               func(ctx context.Context, id uuid.UUID) (bool, enum.Status, error)
	OnListSecureEnvelopes            func(ctx context.Context, txID uuid.UUID, page *models.PageInfo) (*models.SecureEnvelopePage, error)
	OnCreateSecureEnvelope           func(ctx context.Context, in *models.SecureEnvelope, log *models.ComplianceAuditLog) error
	OnRetrieveSecureEnvelope         func(ctx context.Context, txID uuid.UUID, envID ulid.ULID) (*models.SecureEnvelope, error)
	OnUpdateSecureEnvelope           func(ctx context.Context, in *models.SecureEnvelope, log *models.ComplianceAuditLog) error
	OnDeleteSecureEnvelope           func(ctx context.Context, txID uuid.UUID, envID ulid.ULID, log *models.ComplianceAuditLog) error
	OnLatestSecureEnvelope           func(ctx context.Context, txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)
	OnLatestPayloadEnvelope          func(ctx context.Context, txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)
	OnListAccounts                   func(ctx context.Context, in *models.PageInfo) (*models.AccountsPage, error)
	OnCreateAccount                  func(ctx context.Context, in *models.Account, log *models.ComplianceAuditLog) error
	OnLookupAccount                  func(ctx context.Context, cryptoAddress string) (*models.Account, error)
	OnRetrieveAccount                func(ctx context.Context, id ulid.ULID) (*models.Account, error)
	OnUpdateAccount                  func(ctx context.Context, in *models.Account, log *models.ComplianceAuditLog) error
	OnDeleteAccount                  func(ctx context.Context, id ulid.ULID, log *models.ComplianceAuditLog) error
	OnListAccountTransactions        func(ctx context.Context, accountID ulid.ULID, page *models.TransactionPageInfo) (*models.TransactionPage, error)
	OnListCryptoAddresses            func(ctx context.Context, accountID ulid.ULID, page *models.PageInfo) (*models.CryptoAddressPage, error)
	OnCreateCryptoAddress            func(ctx context.Context, in *models.CryptoAddress, log *models.ComplianceAuditLog) error
	OnRetrieveCryptoAddress          func(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (*models.CryptoAddress, error)
	OnUpdateCryptoAddress            func(ctx context.Context, in *models.CryptoAddress, log *models.ComplianceAuditLog) error
	OnDeleteCryptoAddress            func(ctx context.Context, accountID, cryptoAddressID ulid.ULID, log *models.ComplianceAuditLog) error
	OnSearchCounterparties           func(ctx context.Context, query *models.SearchQuery) (*models.CounterpartyPage, error)
	OnListCounterparties             func(ctx context.Context, page *models.CounterpartyPageInfo) (*models.CounterpartyPage, error)
	OnListCounterpartySourceInfo     func(ctx context.Context, source enum.Source) ([]*models.CounterpartySourceInfo, error)
	OnCreateCounterparty             func(ctx context.Context, in *models.Counterparty, log *models.ComplianceAuditLog) error
	OnRetrieveCounterparty           func(ctx context.Context, counterpartyID ulid.ULID) (*models.Counterparty, error)
	OnLookupCounterparty             func(ctx context.Context, field, value string) (*models.Counterparty, error)
	OnUpdateCounterparty             func(ctx context.Context, in *models.Counterparty, log *models.ComplianceAuditLog) error
	OnDeleteCounterparty             func(ctx context.Context, counterpartyID ulid.ULID, log *models.ComplianceAuditLog) error
	OnListContacts                   func(ctx context.Context, counterparty any, page *models.PageInfo) (*models.ContactsPage, error)
	OnCreateContact                  func(ctx context.Context, in *models.Contact, log *models.ComplianceAuditLog) error
	OnRetrieveContact                func(ctx context.Context, contactID, counterparty any) (*models.Contact, error)
	OnUpdateContact                  func(ctx context.Context, in *models.Contact, log *models.ComplianceAuditLog) error
	OnDeleteContact                  func(ctx context.Context, contactID, counterparty any, log *models.ComplianceAuditLog) error
	OnUseTravelAddressFactory        func(models.TravelAddressFactory)
	OnListSunrise                    func(ctx context.Context, page *models.PageInfo) (*models.SunrisePage, error)
	OnCreateSunrise                  func(ctx context.Context, msg *models.Sunrise, log *models.ComplianceAuditLog) error
	OnRetrieveSunrise                func(ctx context.Context, id ulid.ULID) (*models.Sunrise, error)
	OnUpdateSunrise                  func(ctx context.Context, msg *models.Sunrise, log *models.ComplianceAuditLog) error
	OnUpdateSunriseStatus            func(ctx context.Context, txID uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error
	OnDeleteSunrise                  func(ctx context.Context, id ulid.ULID, log *models.ComplianceAuditLog) error
	OnGetOrCreateSunriseCounterparty func(ctx context.Context, email, name string, log *models.ComplianceAuditLog) (*models.Counterparty, error)
	OnListUsers                      func(ctx context.Context, page *models.UserPageInfo) (*models.UserPage, error)
	OnCreateUser                     func(ctx context.Context, in *models.User, log *models.ComplianceAuditLog) error
	OnRetrieveUser                   func(ctx context.Context, emailOrUserID any) (*models.User, error)
	OnUpdateUser                     func(ctx context.Context, in *models.User, log *models.ComplianceAuditLog) error
	OnSetUserPassword                func(ctx context.Context, userID ulid.ULID, password string) (err error)
	OnSetUserLastLogin               func(ctx context.Context, userID ulid.ULID, lastLogin time.Time) (err error)
	OnDeleteUser                     func(ctx context.Context, userID ulid.ULID, log *models.ComplianceAuditLog) error
	OnLookupRole                     func(ctx context.Context, role string) (*models.Role, error)
	OnListAPIKeys                    func(ctx context.Context, in *models.PageInfo) (*models.APIKeyPage, error)
	OnCreateAPIKey                   func(ctx context.Context, in *models.APIKey, log *models.ComplianceAuditLog) error
	OnRetrieveAPIKey                 func(ctx context.Context, clientIDOrKeyID any) (*models.APIKey, error)
	OnUpdateAPIKey                   func(ctx context.Context, in *models.APIKey, log *models.ComplianceAuditLog) error
	OnSetAPIKeyLastSeen              func(ctx context.Context, keyID ulid.ULID, lastSeen time.Time) error
	OnDeleteAPIKey                   func(ctx context.Context, keyID ulid.ULID, log *models.ComplianceAuditLog) error
	OnListResetPasswordLinks         func(ctx context.Context, page *models.PageInfo) (*models.ResetPasswordLinkPage, error)
	OnCreateResetPasswordLink        func(ctx context.Context, link *models.ResetPasswordLink) error
	OnRetrieveResetPasswordLink      func(ctx context.Context, linkID ulid.ULID) (*models.ResetPasswordLink, error)
	OnUpdateResetPasswordLink        func(ctx context.Context, link *models.ResetPasswordLink) error
	OnDeleteResetPasswordLink        func(ctx context.Context, linkID ulid.ULID) (err error)
	OnListComplianceAuditLogs        func(ctx context.Context, page *models.ComplianceAuditLogPageInfo) (*models.ComplianceAuditLogPage, error)
	OnCreateComplianceAuditLog       func(ctx context.Context, log *models.ComplianceAuditLog) error
	OnRetrieveComplianceAuditLog     func(ctx context.Context, id ulid.ULID) (*models.ComplianceAuditLog, error)
	// contains filtered or unexported fields
}

Store implements the store.Store interface with callback functions that the tester can specify to simulate a specific behavior. The Store is not thread-safe and one mock store should be used per test. To set a callback for `Store.Function()`, set the `Store.OnFunction` stub to your desired callback function.

func Open

func Open(uri *dsn.DSN) (*Store, error)

Open a new mock store. Generally, the nil uri can be used to create the mock; otherwise a DSN with the mock scheme can be used.

func (*Store) ArchiveTransaction added in v0.29.0

func (s *Store) ArchiveTransaction(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnArchiveTransaction = ...`

func (*Store) AssertCalls added in v1.1.0

func (s *Store) AssertCalls(t testing.TB, method string, expected int)

Assert that the expected number of calls were made to the given method.

func (*Store) Begin added in v1.1.0

func (s *Store) Begin(ctx context.Context, opts *sql.TxOptions) (txn.Txn, error)

If present, calls the callback previously set for "Begin()" (set the callback with "OnBegin()"), otherwise returns a `Txn` mock.

func (*Store) Close

func (s *Store) Close() error

If present, calls the callback previously set for "Close()" (set the callback with "OnClose()"), otherwise returns `nil` indicating success.

func (*Store) CountTransactions added in v1.0.0

func (s *Store) CountTransactions(ctx context.Context) (*models.TransactionCounts, error)

Calls the callback previously set with `s.OnCountTransactions = ...`

func (*Store) CreateAPIKey

func (s *Store) CreateAPIKey(ctx context.Context, in *models.APIKey, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateAPIKey = ...`

func (*Store) CreateAccount

func (s *Store) CreateAccount(ctx context.Context, in *models.Account, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateAccount = ...`

func (*Store) CreateComplianceAuditLog added in v1.1.0

func (s *Store) CreateComplianceAuditLog(ctx context.Context, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateComplianceAuditLog = ...`

func (*Store) CreateContact added in v0.28.0

func (s *Store) CreateContact(ctx context.Context, in *models.Contact, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateContact = ...`

func (*Store) CreateCounterparty

func (s *Store) CreateCounterparty(ctx context.Context, in *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateCounterparty = ...`

func (*Store) CreateCryptoAddress

func (s *Store) CreateCryptoAddress(ctx context.Context, in *models.CryptoAddress, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateCryptoAddress = ...`

func (s *Store) CreateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) error

Calls the callback previously set with `s.OnCreateResetPasswordLink = ...`

func (*Store) CreateSecureEnvelope

func (s *Store) CreateSecureEnvelope(ctx context.Context, in *models.SecureEnvelope, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateSecureEnvelope = ...`

func (*Store) CreateSunrise added in v0.28.0

func (s *Store) CreateSunrise(ctx context.Context, msg *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateSunrise = ...`

func (*Store) CreateTransaction

func (s *Store) CreateTransaction(ctx context.Context, in *models.Transaction, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateTransaction = ...`

func (*Store) CreateUser

func (s *Store) CreateUser(ctx context.Context, in *models.User, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnCreateUser = ...`

func (*Store) DeleteAPIKey

func (s *Store) DeleteAPIKey(ctx context.Context, keyID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteAPIKey = ...`

func (*Store) DeleteAccount

func (s *Store) DeleteAccount(ctx context.Context, id ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteAccount = ...`

func (*Store) DeleteContact added in v0.28.0

func (s *Store) DeleteContact(ctx context.Context, contactID, counterparty any, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteContact = ...`

func (*Store) DeleteCounterparty

func (s *Store) DeleteCounterparty(ctx context.Context, counterpartyID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteCounterparty = ...`

func (*Store) DeleteCryptoAddress

func (s *Store) DeleteCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteCryptoAddress = ...`

func (s *Store) DeleteResetPasswordLink(ctx context.Context, linkID ulid.ULID) (err error)

Calls the callback previously set with `s.OnDeleteResetPasswordLink = ...`

func (*Store) DeleteSecureEnvelope

func (s *Store) DeleteSecureEnvelope(ctx context.Context, txID uuid.UUID, envID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteSecureEnvelope = ...`

func (*Store) DeleteSunrise added in v0.28.0

func (s *Store) DeleteSunrise(ctx context.Context, id ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteSunrise = ...`

func (*Store) DeleteTransaction

func (s *Store) DeleteTransaction(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteTransaction = ...`

func (*Store) DeleteUser

func (s *Store) DeleteUser(ctx context.Context, userID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnDeleteUser = ...`

func (*Store) GetOrCreateSunriseCounterparty added in v0.28.0

func (s *Store) GetOrCreateSunriseCounterparty(ctx context.Context, email, name string, log *models.ComplianceAuditLog) (*models.Counterparty, error)

Calls the callback previously set with `s.OnGetOrCreateSunriseCounterparty = ...`

func (*Store) LatestPayloadEnvelope added in v0.24.0

func (s *Store) LatestPayloadEnvelope(ctx context.Context, txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)

Calls the callback previously set with `s.OnLatestPayloadEnvelope = ...`

func (*Store) LatestSecureEnvelope added in v0.14.0

func (s *Store) LatestSecureEnvelope(ctx context.Context, txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)

Calls the callback previously set with `s.OnLatestSecureEnvelope = ...`

func (*Store) ListAPIKeys

func (s *Store) ListAPIKeys(ctx context.Context, in *models.PageInfo) (*models.APIKeyPage, error)

Calls the callback previously set with `s.OnListAPIKeys = ...`

func (*Store) ListAccountTransactions added in v1.0.0

func (s *Store) ListAccountTransactions(ctx context.Context, accountID ulid.ULID, page *models.TransactionPageInfo) (*models.TransactionPage, error)

Calls the callback previously set with `s.OnListAccountTransactions = ...`

func (*Store) ListAccounts

func (s *Store) ListAccounts(ctx context.Context, in *models.PageInfo) (*models.AccountsPage, error)

Calls the callback previously set with `s.OnListAccounts = ...`

func (*Store) ListComplianceAuditLogs added in v1.1.0

func (s *Store) ListComplianceAuditLogs(ctx context.Context, page *models.ComplianceAuditLogPageInfo) (*models.ComplianceAuditLogPage, error)

Calls the callback previously set with `s.OnListComplianceAuditLog = ...`

func (*Store) ListContacts added in v0.28.0

func (s *Store) ListContacts(ctx context.Context, counterparty any, page *models.PageInfo) (*models.ContactsPage, error)

Calls the callback previously set with `s.OnListContacts = ...`

func (*Store) ListCounterparties

func (s *Store) ListCounterparties(ctx context.Context, page *models.CounterpartyPageInfo) (*models.CounterpartyPage, error)

Calls the callback previously set with `s.OnListCounterparties = ...`

func (*Store) ListCounterpartySourceInfo

func (s *Store) ListCounterpartySourceInfo(ctx context.Context, source enum.Source) ([]*models.CounterpartySourceInfo, error)

Calls the callback previously set with `s.OnListCounterpartySourceInfo = ...`

func (*Store) ListCryptoAddresses

func (s *Store) ListCryptoAddresses(ctx context.Context, accountID ulid.ULID, page *models.PageInfo) (*models.CryptoAddressPage, error)

Calls the callback previously set with `s.OnListCryptoAddresses = ...`

func (s *Store) ListResetPasswordLinks(ctx context.Context, page *models.PageInfo) (*models.ResetPasswordLinkPage, error)

Calls the callback previously set with `s.OnListResetPasswordLinks = ...`

func (*Store) ListSecureEnvelopes

func (s *Store) ListSecureEnvelopes(ctx context.Context, txID uuid.UUID, page *models.PageInfo) (*models.SecureEnvelopePage, error)

Calls the callback previously set with `s.OnListSecureEnvelopes = ...`

func (*Store) ListSunrise added in v0.28.0

func (s *Store) ListSunrise(ctx context.Context, page *models.PageInfo) (*models.SunrisePage, error)

Calls the callback previously set with `s.OnListSunrise = ...`

func (*Store) ListTransactions

func (s *Store) ListTransactions(ctx context.Context, in *models.TransactionPageInfo) (*models.TransactionPage, error)

Calls the callback previously set with `s.OnListTransactions = ...`

func (*Store) ListUsers

func (s *Store) ListUsers(ctx context.Context, page *models.UserPageInfo) (*models.UserPage, error)

Calls the callback previously set with `s.OnListUsers = ...`

func (*Store) LookupAccount added in v1.0.0

func (s *Store) LookupAccount(ctx context.Context, cryptoAddress string) (*models.Account, error)

Calls the callback previously set with `s.OnLookupAccount = ...`

func (*Store) LookupCounterparty

func (s *Store) LookupCounterparty(ctx context.Context, field, value string) (*models.Counterparty, error)

Calls the callback previously set with `s.OnLookupCounterparty = ...`

func (*Store) LookupRole added in v0.18.0

func (s *Store) LookupRole(ctx context.Context, role string) (*models.Role, error)

Calls the callback previously set with `s.OnLookupRole = ...`

func (*Store) PrepareTransaction

func (s *Store) PrepareTransaction(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) (models.PreparedTransaction, error)

Calls the callback previously set with `s.OnPrepareTransaction = ...`

func (*Store) Reset added in v1.1.0

func (s *Store) Reset()

Reset all the calls and callbacks in the store.

func (*Store) RetrieveAPIKey

func (s *Store) RetrieveAPIKey(ctx context.Context, clientIDOrKeyID any) (*models.APIKey, error)

Calls the callback previously set with `s.OnRetrieveAPIKey = ...`

func (*Store) RetrieveAccount

func (s *Store) RetrieveAccount(ctx context.Context, id ulid.ULID) (*models.Account, error)

Calls the callback previously set with `s.OnRetrieveAccount = ...`

func (*Store) RetrieveComplianceAuditLog added in v1.1.0

func (s *Store) RetrieveComplianceAuditLog(ctx context.Context, id ulid.ULID) (*models.ComplianceAuditLog, error)

Calls the callback previously set with `s.OnRetrieveComplianceAuditLog = ...`

func (*Store) RetrieveContact added in v0.28.0

func (s *Store) RetrieveContact(ctx context.Context, contactID, counterparty any) (*models.Contact, error)

Calls the callback previously set with `s.OnRetrieveContact = ...`

func (*Store) RetrieveCounterparty

func (s *Store) RetrieveCounterparty(ctx context.Context, counterpartyID ulid.ULID) (*models.Counterparty, error)

Calls the callback previously set with `s.OnRetrieveCounterparty = ...`

func (*Store) RetrieveCryptoAddress

func (s *Store) RetrieveCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (*models.CryptoAddress, error)

Calls the callback previously set with `s.OnRetrieveCryptoAddress = ...`

func (s *Store) RetrieveResetPasswordLink(ctx context.Context, linkID ulid.ULID) (*models.ResetPasswordLink, error)

Calls the callback previously set with `s.OnRetrieveResetPasswordLink = ...`

func (*Store) RetrieveSecureEnvelope

func (s *Store) RetrieveSecureEnvelope(ctx context.Context, txID uuid.UUID, envID ulid.ULID) (*models.SecureEnvelope, error)

Calls the callback previously set with `s.OnRetrieveSecureEnvelope = ...`

func (*Store) RetrieveSunrise added in v0.28.0

func (s *Store) RetrieveSunrise(ctx context.Context, id ulid.ULID) (*models.Sunrise, error)

Calls the callback previously set with `s.OnRetrieveSunrise = ...`

func (*Store) RetrieveTransaction

func (s *Store) RetrieveTransaction(ctx context.Context, id uuid.UUID) (*models.Transaction, error)

Calls the callback previously set with `s.OnRetrieveTransaction = ...`

func (*Store) RetrieveUser

func (s *Store) RetrieveUser(ctx context.Context, emailOrUserID any) (*models.User, error)

Calls the callback previously set with `s.OnRetrieveUser = ...`

func (*Store) SearchCounterparties added in v0.23.0

func (s *Store) SearchCounterparties(ctx context.Context, query *models.SearchQuery) (*models.CounterpartyPage, error)

Calls the callback previously set with `s.OnSearchCounterparties = ...`

func (*Store) SetAPIKeyLastSeen added in v1.2.0

func (s *Store) SetAPIKeyLastSeen(ctx context.Context, keyID ulid.ULID, lastSeen time.Time) error

Calls the callback previously set with `s.OnSetAPIKeyLastSeen = ...`

func (*Store) SetUserLastLogin added in v0.18.0

func (s *Store) SetUserLastLogin(ctx context.Context, userID ulid.ULID, lastLogin time.Time) (err error)

Calls the callback previously set with `s.OnSetUserLastLogin = ...`

func (*Store) SetUserPassword

func (s *Store) SetUserPassword(ctx context.Context, userID ulid.ULID, password string) (err error)

Calls the callback previously set with `s.OnSetUserPassword = ...`

func (*Store) TransactionState added in v1.0.0

func (s *Store) TransactionState(ctx context.Context, id uuid.UUID) (bool, enum.Status, error)

Calls the callback previously set with `s.OnTransactionState = ...`

func (*Store) UnarchiveTransaction added in v1.0.0

func (s *Store) UnarchiveTransaction(ctx context.Context, id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUnarchiveTransaction = ...`

func (*Store) UpdateAPIKey

func (s *Store) UpdateAPIKey(ctx context.Context, in *models.APIKey, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateAPIKey = ...`

func (*Store) UpdateAccount

func (s *Store) UpdateAccount(ctx context.Context, in *models.Account, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateAccount = ...`

func (*Store) UpdateContact added in v0.28.0

func (s *Store) UpdateContact(ctx context.Context, in *models.Contact, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateContact = ...`

func (*Store) UpdateCounterparty

func (s *Store) UpdateCounterparty(ctx context.Context, in *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateCounterparty = ...`

func (*Store) UpdateCryptoAddress

func (s *Store) UpdateCryptoAddress(ctx context.Context, in *models.CryptoAddress, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateCryptoAddress = ...`

func (s *Store) UpdateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) error

Calls the callback previously set with `s.OnUpdateResetPasswordLink = ...`

func (*Store) UpdateSecureEnvelope

func (s *Store) UpdateSecureEnvelope(ctx context.Context, in *models.SecureEnvelope, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateSecureEnvelope = ...`

func (*Store) UpdateSunrise added in v0.28.0

func (s *Store) UpdateSunrise(ctx context.Context, msg *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateSunrise = ...`

func (*Store) UpdateSunriseStatus added in v1.0.0

func (s *Store) UpdateSunriseStatus(ctx context.Context, txID uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateSunriseStatus = ...`

func (*Store) UpdateTransaction

func (s *Store) UpdateTransaction(ctx context.Context, in *models.Transaction, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateTransaction = ...`

func (*Store) UpdateUser

func (s *Store) UpdateUser(ctx context.Context, in *models.User, log *models.ComplianceAuditLog) error

Calls the callback previously set with `s.OnUpdateUser = ...`

func (*Store) UseTravelAddressFactory

func (s *Store) UseTravelAddressFactory(f models.TravelAddressFactory)

Calls the callback previously set with `s.OnUseTravelAddressFactory = ...`

type Tx added in v1.1.0

type Tx struct {
	OnCommit                         func() error
	OnRollback                       func() error
	OnListTransactions               func(in *models.TransactionPageInfo) (*models.TransactionPage, error)
	OnCreateTransaction              func(in *models.Transaction, log *models.ComplianceAuditLog) error
	OnRetrieveTransaction            func(id uuid.UUID) (*models.Transaction, error)
	OnUpdateTransaction              func(in *models.Transaction, log *models.ComplianceAuditLog) error
	OnDeleteTransaction              func(id uuid.UUID, log *models.ComplianceAuditLog) error
	OnArchiveTransaction             func(id uuid.UUID, log *models.ComplianceAuditLog) error
	OnUnarchiveTransaction           func(id uuid.UUID, log *models.ComplianceAuditLog) error
	OnCountTransactions              func() (*models.TransactionCounts, error)
	OnTransactionState               func(id uuid.UUID) (bool, enum.Status, error)
	OnListSecureEnvelopes            func(txID uuid.UUID, page *models.PageInfo) (*models.SecureEnvelopePage, error)
	OnCreateSecureEnvelope           func(in *models.SecureEnvelope, log *models.ComplianceAuditLog) error
	OnRetrieveSecureEnvelope         func(txID uuid.UUID, envID ulid.ULID) (*models.SecureEnvelope, error)
	OnUpdateSecureEnvelope           func(in *models.SecureEnvelope, log *models.ComplianceAuditLog) error
	OnDeleteSecureEnvelope           func(txID uuid.UUID, envID ulid.ULID, log *models.ComplianceAuditLog) error
	OnLatestSecureEnvelope           func(txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)
	OnLatestPayloadEnvelope          func(txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)
	OnListAccounts                   func(page *models.PageInfo) (*models.AccountsPage, error)
	OnCreateAccount                  func(in *models.Account, log *models.ComplianceAuditLog) error
	OnLookupAccount                  func(cryptoAddress string) (*models.Account, error)
	OnRetrieveAccount                func(id ulid.ULID) (*models.Account, error)
	OnUpdateAccount                  func(in *models.Account, log *models.ComplianceAuditLog) error
	OnDeleteAccount                  func(id ulid.ULID, log *models.ComplianceAuditLog) error
	OnListAccountTransactions        func(accountID ulid.ULID, page *models.TransactionPageInfo) (*models.TransactionPage, error)
	OnListCryptoAddresses            func(accountID ulid.ULID, page *models.PageInfo) (*models.CryptoAddressPage, error)
	OnCreateCryptoAddress            func(in *models.CryptoAddress, log *models.ComplianceAuditLog) error
	OnRetrieveCryptoAddress          func(accountID, cryptoAddressID ulid.ULID) (*models.CryptoAddress, error)
	OnUpdateCryptoAddress            func(in *models.CryptoAddress, log *models.ComplianceAuditLog) error
	OnDeleteCryptoAddress            func(accountID, cryptoAddressID ulid.ULID, log *models.ComplianceAuditLog) error
	OnSearchCounterparties           func(query *models.SearchQuery) (*models.CounterpartyPage, error)
	OnListCounterparties             func(page *models.CounterpartyPageInfo) (*models.CounterpartyPage, error)
	OnListCounterpartySourceInfo     func(source enum.Source) ([]*models.CounterpartySourceInfo, error)
	OnCreateCounterparty             func(in *models.Counterparty, log *models.ComplianceAuditLog) error
	OnRetrieveCounterparty           func(counterpartyID ulid.ULID) (*models.Counterparty, error)
	OnLookupCounterparty             func(field, value string) (*models.Counterparty, error)
	OnUpdateCounterparty             func(in *models.Counterparty, log *models.ComplianceAuditLog) error
	OnDeleteCounterparty             func(counterpartyID ulid.ULID, log *models.ComplianceAuditLog) error
	OnListContacts                   func(counterparty any, page *models.PageInfo) (*models.ContactsPage, error)
	OnCreateContact                  func(in *models.Contact, log *models.ComplianceAuditLog) error
	OnRetrieveContact                func(contactID, counterpartyID any) (*models.Contact, error)
	OnUpdateContact                  func(in *models.Contact, log *models.ComplianceAuditLog) error
	OnDeleteContact                  func(contactID, counterpartyID any, log *models.ComplianceAuditLog) error
	OnListSunrise                    func(in *models.PageInfo) (*models.SunrisePage, error)
	OnCreateSunrise                  func(in *models.Sunrise, log *models.ComplianceAuditLog) error
	OnRetrieveSunrise                func(id ulid.ULID) (*models.Sunrise, error)
	OnUpdateSunrise                  func(in *models.Sunrise, log *models.ComplianceAuditLog) error
	OnUpdateSunriseStatus            func(id uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error
	OnDeleteSunrise                  func(in ulid.ULID, log *models.ComplianceAuditLog) error
	OnGetOrCreateSunriseCounterparty func(email, name string, log *models.ComplianceAuditLog) (*models.Counterparty, error)
	OnListUsers                      func(page *models.UserPageInfo) (*models.UserPage, error)
	OnCreateUser                     func(in *models.User, log *models.ComplianceAuditLog) error
	OnRetrieveUser                   func(emailOrUserID any) (*models.User, error)
	OnUpdateUser                     func(in *models.User, log *models.ComplianceAuditLog) error
	OnSetUserPassword                func(userID ulid.ULID, password string) error
	OnSetUserLastLogin               func(userID ulid.ULID, lastLogin time.Time) error
	OnDeleteUser                     func(userID ulid.ULID, log *models.ComplianceAuditLog) error
	OnLookupRole                     func(role string) (*models.Role, error)
	OnListAPIKeys                    func(page *models.PageInfo) (*models.APIKeyPage, error)
	OnCreateAPIKey                   func(in *models.APIKey, log *models.ComplianceAuditLog) error
	OnRetrieveAPIKey                 func(clientIDOrKeyID any) (*models.APIKey, error)
	OnUpdateAPIKey                   func(in *models.APIKey, log *models.ComplianceAuditLog) error
	OnSetAPIKeyLastSeen              func(keyID ulid.ULID, lastSeen time.Time) error
	OnDeleteAPIKey                   func(keyID ulid.ULID, log *models.ComplianceAuditLog) error
	OnListResetPasswordLinks         func(page *models.PageInfo) (*models.ResetPasswordLinkPage, error)
	OnCreateResetPasswordLink        func(in *models.ResetPasswordLink) error
	OnRetrieveResetPasswordLink      func(id ulid.ULID) (*models.ResetPasswordLink, error)
	OnUpdateResetPasswordLink        func(in *models.ResetPasswordLink) error
	OnDeleteResetPasswordLink        func(id ulid.ULID) error
	OnListComplianceAuditLogs        func(page *models.ComplianceAuditLogPageInfo) (*models.ComplianceAuditLogPage, error)
	OnCreateComplianceAuditLog       func(log *models.ComplianceAuditLog) error
	OnRetrieveComplianceAuditLog     func(id ulid.ULID) (*models.ComplianceAuditLog, error)
	OnListDaybreak                   func() (map[string]*models.CounterpartySourceInfo, error)
	OnCreateDaybreak                 func(counterparty *models.Counterparty) error
	OnUpdateDaybreak                 func(counterparty *models.Counterparty) error
	OnDeleteDaybreak                 func(counterpartyID ulid.ULID, ignoreTxns bool) error
	// contains filtered or unexported fields
}

Tx implements the store.Txn interface using a mock store. The test user can specify any callbacks to simulate specific behaviors. By default the Tx struct will respect the readonly option so long as no overriding method is provided.

func (*Tx) ArchiveTransaction added in v1.1.0

func (tx *Tx) ArchiveTransaction(id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnArchiveTransaction()".

func (*Tx) AssertCalls added in v1.1.0

func (tx *Tx) AssertCalls(t testing.TB, method string, expected int)

Assert that the expected number of calls were made to the given method.

func (*Tx) AssertCommit added in v1.1.0

func (tx *Tx) AssertCommit(t testing.TB)

Assert that Commit has been called on the transaction without rollback.

func (*Tx) AssertNoCommit added in v1.1.0

func (tx *Tx) AssertNoCommit(t testing.TB)

Assert that Commit has not been called on the transaction.

func (*Tx) AssertNoRollback added in v1.1.0

func (tx *Tx) AssertNoRollback(t testing.TB)

Assert that Rollback has not been called on the transaction.

func (*Tx) AssertRollback added in v1.1.0

func (tx *Tx) AssertRollback(t testing.TB)

Assert that Rollback has been called on the transaction without commit.

func (*Tx) Commit added in v1.1.0

func (tx *Tx) Commit() error

Calls the callback previously set with "OnCommit()", or completes the "commit" for the transaction.

func (*Tx) CountTransactions added in v1.1.0

func (tx *Tx) CountTransactions() (*models.TransactionCounts, error)

Calls the callback previously set with "OnCountTransactions()".

func (*Tx) CreateAPIKey added in v1.1.0

func (tx *Tx) CreateAPIKey(in *models.APIKey, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateAPIKey()".

func (*Tx) CreateAccount added in v1.1.0

func (tx *Tx) CreateAccount(in *models.Account, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateAccount()".

func (*Tx) CreateComplianceAuditLog added in v1.1.0

func (tx *Tx) CreateComplianceAuditLog(log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateComplianceAuditLog()".

func (*Tx) CreateContact added in v1.1.0

func (tx *Tx) CreateContact(in *models.Contact, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateContact()".

func (*Tx) CreateCounterparty added in v1.1.0

func (tx *Tx) CreateCounterparty(in *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateCounterparty()".

func (*Tx) CreateCryptoAddress added in v1.1.0

func (tx *Tx) CreateCryptoAddress(in *models.CryptoAddress, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateCryptoAddress()".

func (*Tx) CreateDaybreak added in v1.1.0

func (tx *Tx) CreateDaybreak(counterparty *models.Counterparty) error

Calls the callback previously set with "OnCreateDaybreak()".

func (tx *Tx) CreateResetPasswordLink(in *models.ResetPasswordLink) error

Calls the callback previously set with "OnCreateResetPasswordLink()".

func (*Tx) CreateSecureEnvelope added in v1.1.0

func (tx *Tx) CreateSecureEnvelope(in *models.SecureEnvelope, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateSecureEnvelope()".

func (*Tx) CreateSunrise added in v1.1.0

func (tx *Tx) CreateSunrise(in *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateSunrise()".

func (*Tx) CreateTransaction added in v1.1.0

func (tx *Tx) CreateTransaction(in *models.Transaction, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateTransaction()".

func (*Tx) CreateUser added in v1.1.0

func (tx *Tx) CreateUser(in *models.User, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnCreateUser()".

func (*Tx) DeleteAPIKey added in v1.1.0

func (tx *Tx) DeleteAPIKey(keyID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteAPIKey()".

func (*Tx) DeleteAccount added in v1.1.0

func (tx *Tx) DeleteAccount(id ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteAccount()".

func (*Tx) DeleteContact added in v1.1.0

func (tx *Tx) DeleteContact(contactID, counterpartyID any, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteContact()".

func (*Tx) DeleteCounterparty added in v1.1.0

func (tx *Tx) DeleteCounterparty(counterpartyID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteCounterparty()".

func (*Tx) DeleteCryptoAddress added in v1.1.0

func (tx *Tx) DeleteCryptoAddress(accountID, cryptoAddressID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteCryptoAddress()".

func (*Tx) DeleteDaybreak added in v1.1.0

func (tx *Tx) DeleteDaybreak(counterpartyID ulid.ULID, ignoreTxns bool) error

Calls the callback previously set with "OnDeleteDaybreak()".

func (tx *Tx) DeleteResetPasswordLink(id ulid.ULID) error

Calls the callback previously set with "OnDeleteResetPasswordLink()".

func (*Tx) DeleteSecureEnvelope added in v1.1.0

func (tx *Tx) DeleteSecureEnvelope(txID uuid.UUID, envID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteSecureEnvelope()".

func (*Tx) DeleteSunrise added in v1.1.0

func (tx *Tx) DeleteSunrise(in ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteSunrise()".

func (*Tx) DeleteTransaction added in v1.1.0

func (tx *Tx) DeleteTransaction(id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteTransaction()".

func (*Tx) DeleteUser added in v1.1.0

func (tx *Tx) DeleteUser(userID ulid.ULID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnDeleteUser()".

func (*Tx) GetActor added in v1.2.0

func (tx *Tx) GetActor() ([]byte, enum.Actor)

Returns the actor metadata set by SetActor().

func (*Tx) GetOrCreateSunriseCounterparty added in v1.1.0

func (tx *Tx) GetOrCreateSunriseCounterparty(email, name string, log *models.ComplianceAuditLog) (*models.Counterparty, error)

Calls the callback previously set with "OnGetOrCreateSunriseCounterparty()".

func (*Tx) LatestPayloadEnvelope added in v1.1.0

func (tx *Tx) LatestPayloadEnvelope(txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)

Calls the callback previously set with "OnLatestPayloadEnvelope()".

func (*Tx) LatestSecureEnvelope added in v1.1.0

func (tx *Tx) LatestSecureEnvelope(txID uuid.UUID, direction enum.Direction) (*models.SecureEnvelope, error)

Calls the callback previously set with "OnLatestSecureEnvelope()".

func (*Tx) ListAPIKeys added in v1.1.0

func (tx *Tx) ListAPIKeys(page *models.PageInfo) (*models.APIKeyPage, error)

Calls the callback previously set with "OnListAPIKeys()".

func (*Tx) ListAccountTransactions added in v1.1.0

func (tx *Tx) ListAccountTransactions(accountID ulid.ULID, page *models.TransactionPageInfo) (*models.TransactionPage, error)

Calls the callback previously set with "OnListAccountTransactions()".

func (*Tx) ListAccounts added in v1.1.0

func (tx *Tx) ListAccounts(page *models.PageInfo) (*models.AccountsPage, error)

Calls the callback previously set with "OnListAccounts()".

func (*Tx) ListComplianceAuditLogs added in v1.1.0

func (tx *Tx) ListComplianceAuditLogs(page *models.ComplianceAuditLogPageInfo) (*models.ComplianceAuditLogPage, error)

Calls the callback previously set with "OnListComplianceAuditLogs()".

func (*Tx) ListContacts added in v1.1.0

func (tx *Tx) ListContacts(counterparty any, page *models.PageInfo) (*models.ContactsPage, error)

Calls the callback previously set with "OnListContacts()".

func (*Tx) ListCounterparties added in v1.1.0

func (tx *Tx) ListCounterparties(page *models.CounterpartyPageInfo) (*models.CounterpartyPage, error)

Calls the callback previously set with "OnListCounterparties()".

func (*Tx) ListCounterpartySourceInfo added in v1.1.0

func (tx *Tx) ListCounterpartySourceInfo(source enum.Source) ([]*models.CounterpartySourceInfo, error)

Calls the callback previously set with "OnListCounterpartySourceInfo()".

func (*Tx) ListCryptoAddresses added in v1.1.0

func (tx *Tx) ListCryptoAddresses(accountID ulid.ULID, page *models.PageInfo) (*models.CryptoAddressPage, error)

Calls the callback previously set with "OnListCryptoAddresses()".

func (*Tx) ListDaybreak added in v1.1.0

func (tx *Tx) ListDaybreak() (map[string]*models.CounterpartySourceInfo, error)

Calls the callback previously set with "OnListDaybreak()".

func (tx *Tx) ListResetPasswordLinks(page *models.PageInfo) (*models.ResetPasswordLinkPage, error)

Calls the callback previously set with "OnListResetPasswordLinks()".

func (*Tx) ListSecureEnvelopes added in v1.1.0

func (tx *Tx) ListSecureEnvelopes(txID uuid.UUID, page *models.PageInfo) (*models.SecureEnvelopePage, error)

Calls the callback previously set with "OnListSecureEnvelopes()".

func (*Tx) ListSunrise added in v1.1.0

func (tx *Tx) ListSunrise(in *models.PageInfo) (*models.SunrisePage, error)

Calls the callback previously set with "OnListSunrise()".

func (*Tx) ListTransactions added in v1.1.0

func (tx *Tx) ListTransactions(in *models.TransactionPageInfo) (*models.TransactionPage, error)

Calls the callback previously set with "OnListTransactions()".

func (*Tx) ListUsers added in v1.1.0

func (tx *Tx) ListUsers(page *models.UserPageInfo) (*models.UserPage, error)

Calls the callback previously set with "OnListUsers()".

func (*Tx) LookupAccount added in v1.1.0

func (tx *Tx) LookupAccount(cryptoAddress string) (*models.Account, error)

Calls the callback previously set with "OnLookupAccount()".

func (*Tx) LookupCounterparty added in v1.1.0

func (tx *Tx) LookupCounterparty(field, value string) (*models.Counterparty, error)

Calls the callback previously set with "OnLookupCounterparty()".

func (*Tx) LookupRole added in v1.1.0

func (tx *Tx) LookupRole(role string) (*models.Role, error)

Calls the callback previously set with "OnLookupRole()".

func (*Tx) Reset added in v1.1.0

func (tx *Tx) Reset()

Reset all the calls and callbacks in the transaction, if you don't want to create a new one.

func (*Tx) RetrieveAPIKey added in v1.1.0

func (tx *Tx) RetrieveAPIKey(clientIDOrKeyID any) (*models.APIKey, error)

Calls the callback previously set with "OnRetrieveAPIKey()".

func (*Tx) RetrieveAccount added in v1.1.0

func (tx *Tx) RetrieveAccount(id ulid.ULID) (*models.Account, error)

Calls the callback previously set with "OnRetrieveAccount()".

func (*Tx) RetrieveComplianceAuditLog added in v1.1.0

func (tx *Tx) RetrieveComplianceAuditLog(id ulid.ULID) (*models.ComplianceAuditLog, error)

Calls the callback previously set with "OnCreateComplianceAuditLog()".

func (*Tx) RetrieveContact added in v1.1.0

func (tx *Tx) RetrieveContact(contactID, counterpartyID any) (*models.Contact, error)

Calls the callback previously set with "OnRetrieveContact()".

func (*Tx) RetrieveCounterparty added in v1.1.0

func (tx *Tx) RetrieveCounterparty(counterpartyID ulid.ULID) (*models.Counterparty, error)

Calls the callback previously set with "OnRetrieveCounterparty()".

func (*Tx) RetrieveCryptoAddress added in v1.1.0

func (tx *Tx) RetrieveCryptoAddress(accountID, cryptoAddressID ulid.ULID) (*models.CryptoAddress, error)

Calls the callback previously set with "OnRetrieveCryptoAddress()".

func (tx *Tx) RetrieveResetPasswordLink(id ulid.ULID) (*models.ResetPasswordLink, error)

Calls the callback previously set with "OnRetrieveResetPasswordLink()".

func (*Tx) RetrieveSecureEnvelope added in v1.1.0

func (tx *Tx) RetrieveSecureEnvelope(txID uuid.UUID, envID ulid.ULID) (*models.SecureEnvelope, error)

Calls the callback previously set with "OnRetrieveSecureEnvelope()".

func (*Tx) RetrieveSunrise added in v1.1.0

func (tx *Tx) RetrieveSunrise(id ulid.ULID) (*models.Sunrise, error)

Calls the callback previously set with "OnRetrieveSunrise()".

func (*Tx) RetrieveTransaction added in v1.1.0

func (tx *Tx) RetrieveTransaction(id uuid.UUID) (*models.Transaction, error)

Calls the callback previously set with "OnRetrieveTransaction()".

func (*Tx) RetrieveUser added in v1.1.0

func (tx *Tx) RetrieveUser(emailOrUserID any) (*models.User, error)

Calls the callback previously set with "OnRetrieveUser()".

func (*Tx) Rollback added in v1.1.0

func (tx *Tx) Rollback() error

Calls the callback previously set with "OnRollback()", or completes the "rollback" for the transaction.

func (*Tx) SearchCounterparties added in v1.1.0

func (tx *Tx) SearchCounterparties(query *models.SearchQuery) (*models.CounterpartyPage, error)

Calls the callback previously set with "OnSearchCounterparties()".

func (*Tx) SetAPIKeyLastSeen added in v1.2.0

func (tx *Tx) SetAPIKeyLastSeen(keyID ulid.ULID, lastSeen time.Time) error

Calls the callback previously set with `OnSetAPIKeyLastSeen()`

func (*Tx) SetActor added in v1.2.0

func (tx *Tx) SetActor(actorID []byte, actorType enum.Actor)

Sets the actor metadata to be returned by GetActor().

func (*Tx) SetUserLastLogin added in v1.1.0

func (tx *Tx) SetUserLastLogin(userID ulid.ULID, lastLogin time.Time) error

Calls the callback previously set with "OnSetUserLastLogin()".

func (*Tx) SetUserPassword added in v1.1.0

func (tx *Tx) SetUserPassword(userID ulid.ULID, password string) error

Calls the callback previously set with "OnSetUserPassword()".

func (*Tx) TransactionState added in v1.1.0

func (tx *Tx) TransactionState(id uuid.UUID) (bool, enum.Status, error)

Calls the callback previously set with "OnTransactionState()".

func (*Tx) UnarchiveTransaction added in v1.1.0

func (tx *Tx) UnarchiveTransaction(id uuid.UUID, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUnarchiveTransaction()".

func (*Tx) UpdateAPIKey added in v1.1.0

func (tx *Tx) UpdateAPIKey(in *models.APIKey, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateAPIKey()".

func (*Tx) UpdateAccount added in v1.1.0

func (tx *Tx) UpdateAccount(in *models.Account, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateAccount()".

func (*Tx) UpdateContact added in v1.1.0

func (tx *Tx) UpdateContact(in *models.Contact, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateContact()".

func (*Tx) UpdateCounterparty added in v1.1.0

func (tx *Tx) UpdateCounterparty(in *models.Counterparty, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateCounterparty()".

func (*Tx) UpdateCryptoAddress added in v1.1.0

func (tx *Tx) UpdateCryptoAddress(in *models.CryptoAddress, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateCryptoAddress()".

func (*Tx) UpdateDaybreak added in v1.1.0

func (tx *Tx) UpdateDaybreak(counterparty *models.Counterparty) error

Calls the callback previously set with "OnUpdateDaybreak()".

func (tx *Tx) UpdateResetPasswordLink(in *models.ResetPasswordLink) error

Calls the callback previously set with "OnUpdateResetPasswordLink()".

func (*Tx) UpdateSecureEnvelope added in v1.1.0

func (tx *Tx) UpdateSecureEnvelope(in *models.SecureEnvelope, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateSecureEnvelope()".

func (*Tx) UpdateSunrise added in v1.1.0

func (tx *Tx) UpdateSunrise(in *models.Sunrise, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateSunrise()".

func (*Tx) UpdateSunriseStatus added in v1.1.0

func (tx *Tx) UpdateSunriseStatus(id uuid.UUID, status enum.Status, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateSunriseStatus()".

func (*Tx) UpdateTransaction added in v1.1.0

func (tx *Tx) UpdateTransaction(in *models.Transaction, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateTransaction()".

func (*Tx) UpdateUser added in v1.1.0

func (tx *Tx) UpdateUser(in *models.User, log *models.ComplianceAuditLog) error

Calls the callback previously set with "OnUpdateUser()".

Jump to

Keyboard shortcuts

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