Documentation
¶
Index ¶
- func GetThreshold() float64
- func IsURLCandidate(query string) bool
- func NormURL(query string) string
- func Rank(term, query string) (int, float64)
- func SetThreshold(t float64)
- type Migration
- type PreparedTransaction
- func (p *PreparedTransaction) AddCounterparty(in *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (p *PreparedTransaction) AddEnvelope(in *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
- func (p *PreparedTransaction) Commit() error
- func (p *PreparedTransaction) CreateSunrise(in *models.Sunrise, auditLog *models.ComplianceAuditLog) error
- func (p *PreparedTransaction) Created() bool
- func (p *PreparedTransaction) Fetch() (transaction *models.Transaction, err error)
- func (p *PreparedTransaction) LookupCounterparty(field, value string) (*models.Counterparty, error)
- func (p *PreparedTransaction) Rollback() error
- func (p *PreparedTransaction) Update(in *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
- func (p *PreparedTransaction) UpdateCounterparty(in *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (p *PreparedTransaction) UpdateSunrise(in *models.Sunrise, auditLog *models.ComplianceAuditLog) error
- func (p *PreparedTransaction) UpdateSunriseStatus(txID uuid.UUID, status enum.Status, auditLog *models.ComplianceAuditLog) error
- type RankItem
- type RankList
- type SearchRank
- type Store
- func (s *Store) ArchiveTransaction(ctx context.Context, transactionID uuid.UUID, ...) (err error)
- func (s *Store) Begin(ctx context.Context, opts *sql.TxOptions) (txn.Txn, error)
- func (s *Store) BeginTx(ctx context.Context, opts *sql.TxOptions) (_ *Tx, err error)
- func (s *Store) Close() error
- func (s *Store) CountTransactions(ctx context.Context) (counts *models.TransactionCounts, err error)
- func (s *Store) CreateAPIKey(ctx context.Context, key *models.APIKey, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) CreateAccount(ctx context.Context, account *models.Account, ...) (err error)
- func (s *Store) CreateComplianceAuditLog(ctx context.Context, log *models.ComplianceAuditLog) (err error)
- func (s *Store) CreateContact(ctx context.Context, contact *models.Contact, ...) (err error)
- func (s *Store) CreateCounterparty(ctx context.Context, counterparty *models.Counterparty, ...) (err error)
- func (s *Store) CreateCryptoAddress(ctx context.Context, addr *models.CryptoAddress, ...) (err error)
- func (s *Store) CreateDaybreak(ctx context.Context, counterparty *models.Counterparty, ...) (err error)
- func (s *Store) CreateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) (err error)
- func (s *Store) CreateSecureEnvelope(ctx context.Context, env *models.SecureEnvelope, ...) (err error)
- func (s *Store) CreateSunrise(ctx context.Context, msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) CreateTransaction(ctx context.Context, transaction *models.Transaction, ...) (err error)
- func (s *Store) CreateUser(ctx context.Context, user *models.User, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) DeleteAPIKey(ctx context.Context, keyID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) DeleteAccount(ctx context.Context, accountID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) DeleteContact(ctx context.Context, contactID, counterparty any, ...) (err error)
- func (s *Store) DeleteCounterparty(ctx context.Context, counterpartyID ulid.ULID, ...) (err error)
- func (s *Store) DeleteCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID, ...) (err error)
- func (s *Store) DeleteDaybreak(ctx context.Context, counterpartyID ulid.ULID, ignoreTxns bool, ...) (err error)
- func (s *Store) DeleteResetPasswordLink(ctx context.Context, linkID ulid.ULID) (err error)
- func (s *Store) DeleteSecureEnvelope(ctx context.Context, txID uuid.UUID, envID ulid.ULID, ...) (err error)
- func (s *Store) DeleteSunrise(ctx context.Context, id ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) DeleteTransaction(ctx context.Context, id uuid.UUID, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) DeleteUser(ctx context.Context, userID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) GetOrCreateSunriseCounterparty(ctx context.Context, email, name string, auditLog *models.ComplianceAuditLog) (out *models.Counterparty, err error)
- func (s *Store) InitializeSchema(empty bool) (err error)
- func (s *Store) LatestPayloadEnvelope(ctx context.Context, envelopeID uuid.UUID, direction enum.Direction) (env *models.SecureEnvelope, err error)
- func (s *Store) LatestSecureEnvelope(ctx context.Context, envelopeID uuid.UUID, direction enum.Direction) (env *models.SecureEnvelope, err error)
- func (s *Store) ListAPIKeys(ctx context.Context, page *models.PageInfo) (out *models.APIKeyPage, err error)
- func (s *Store) ListAccountTransactions(ctx context.Context, accountID ulid.ULID, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
- func (s *Store) ListAccounts(ctx context.Context, page *models.PageInfo) (out *models.AccountsPage, err error)
- func (s *Store) ListComplianceAuditLogs(ctx context.Context, page *models.ComplianceAuditLogPageInfo) (out *models.ComplianceAuditLogPage, err error)
- func (s *Store) ListContacts(ctx context.Context, counterparty any, page *models.PageInfo) (out *models.ContactsPage, err error)
- func (s *Store) ListCounterparties(ctx context.Context, page *models.CounterpartyPageInfo) (out *models.CounterpartyPage, err error)
- func (s *Store) ListCounterpartySourceInfo(ctx context.Context, source enum.Source) (out []*models.CounterpartySourceInfo, err error)
- func (s *Store) ListCryptoAddresses(ctx context.Context, accountID ulid.ULID, page *models.PageInfo) (out *models.CryptoAddressPage, err error)
- func (s *Store) ListDaybreak(ctx context.Context) (out map[string]*models.CounterpartySourceInfo, err error)
- func (s *Store) ListResetPasswordLinks(ctx context.Context, page *models.PageInfo) (out *models.ResetPasswordLinkPage, err error)
- func (s *Store) ListSecureEnvelopes(ctx context.Context, txID uuid.UUID, page *models.PageInfo) (out *models.SecureEnvelopePage, err error)
- func (s *Store) ListSunrise(ctx context.Context, page *models.PageInfo) (out *models.SunrisePage, err error)
- func (s *Store) ListTransactions(ctx context.Context, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
- func (s *Store) ListUsers(ctx context.Context, page *models.UserPageInfo) (out *models.UserPage, err error)
- func (s *Store) LookupAccount(ctx context.Context, cryptoAddress string) (account *models.Account, err error)
- func (s *Store) LookupCounterparty(ctx context.Context, field, value string) (counterparty *models.Counterparty, err error)
- func (s *Store) LookupRole(ctx context.Context, role string) (model *models.Role, err error)
- func (s *Store) PrepareTransaction(ctx context.Context, envelopeID uuid.UUID, auditLog *models.ComplianceAuditLog) (_ models.PreparedTransaction, err error)
- func (s *Store) RetrieveAPIKey(ctx context.Context, clientIDOrKeyID any) (key *models.APIKey, err error)
- func (s *Store) RetrieveAccount(ctx context.Context, accountID ulid.ULID) (account *models.Account, err error)
- func (s *Store) RetrieveComplianceAuditLog(ctx context.Context, id ulid.ULID) (log *models.ComplianceAuditLog, err error)
- func (s *Store) RetrieveContact(ctx context.Context, contactID, counterparty any) (contact *models.Contact, err error)
- func (s *Store) RetrieveCounterparty(ctx context.Context, counterpartyID ulid.ULID) (counterparty *models.Counterparty, err error)
- func (s *Store) RetrieveCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (addr *models.CryptoAddress, err error)
- func (s *Store) RetrieveResetPasswordLink(ctx context.Context, linkID ulid.ULID) (link *models.ResetPasswordLink, err error)
- func (s *Store) RetrieveSecureEnvelope(ctx context.Context, txID uuid.UUID, envID ulid.ULID) (env *models.SecureEnvelope, err error)
- func (s *Store) RetrieveSunrise(ctx context.Context, id ulid.ULID) (msg *models.Sunrise, err error)
- func (s *Store) RetrieveTransaction(ctx context.Context, id uuid.UUID) (transaction *models.Transaction, err error)
- func (s *Store) RetrieveUser(ctx context.Context, emailOrUserID any) (user *models.User, err error)
- func (s *Store) SearchCounterparties(ctx context.Context, query *models.SearchQuery) (out *models.CounterpartyPage, err error)
- func (s *Store) SetAPIKeyLastSeen(ctx context.Context, keyID ulid.ULID, lastSeen time.Time) (err error)
- func (s *Store) SetUserLastLogin(ctx context.Context, userID ulid.ULID, lastLogin time.Time) (err error)
- func (s *Store) SetUserPassword(ctx context.Context, userID ulid.ULID, password string) (err error)
- func (s *Store) Stats() sql.DBStats
- func (s *Store) TransactionState(ctx context.Context, transactionID uuid.UUID) (archived bool, status enum.Status, err error)
- func (s *Store) UnarchiveTransaction(ctx context.Context, transactionID uuid.UUID, ...) (err error)
- func (s *Store) UpdateAPIKey(ctx context.Context, key *models.APIKey, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) UpdateAccount(ctx context.Context, account *models.Account, ...) (err error)
- func (s *Store) UpdateContact(ctx context.Context, contact *models.Contact, ...) (err error)
- func (s *Store) UpdateCounterparty(ctx context.Context, counterparty *models.Counterparty, ...) (err error)
- func (s *Store) UpdateCryptoAddress(ctx context.Context, addr *models.CryptoAddress, ...) (err error)
- func (s *Store) UpdateDaybreak(ctx context.Context, counterparty *models.Counterparty, ...) (err error)
- func (s *Store) UpdateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) (err error)
- func (s *Store) UpdateSecureEnvelope(ctx context.Context, env *models.SecureEnvelope, ...) (err error)
- func (s *Store) UpdateSunrise(ctx context.Context, msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) UpdateSunriseStatus(ctx context.Context, txID uuid.UUID, status enum.Status, ...) (err error)
- func (s *Store) UpdateTransaction(ctx context.Context, t *models.Transaction, ...) (err error)
- func (s *Store) UpdateUser(ctx context.Context, user *models.User, auditLog *models.ComplianceAuditLog) (err error)
- func (s *Store) UseTravelAddressFactory(f models.TravelAddressFactory)
- type Tx
- func (t *Tx) ArchiveTransaction(transactionID uuid.UUID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) Commit() error
- func (t *Tx) CountTransactions() (counts *models.TransactionCounts, err error)
- func (t *Tx) CreateAPIKey(key *models.APIKey, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateAccount(account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateComplianceAuditLog(log *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateContact(contact *models.Contact, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateCounterparty(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateCryptoAddress(addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateDaybreak(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateResetPasswordLink(link *models.ResetPasswordLink) (err error)
- func (t *Tx) CreateSecureEnvelope(env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateSunrise(msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateTransaction(transaction *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) CreateUser(user *models.User, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteAPIKey(keyID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteAccount(accountID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteContact(contactID, counterparty any, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteCounterparty(counterpartyID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteCryptoAddress(accountID, cryptoAddressID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteDaybreak(counterpartyID ulid.ULID, ignoreTxns bool, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteResetPasswordLink(linkID ulid.ULID) (err error)
- func (t *Tx) DeleteSecureEnvelope(txID uuid.UUID, envID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteSunrise(id ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteTransaction(id uuid.UUID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) DeleteUser(userID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) Exec(query string, args ...any) (sql.Result, error)
- func (t *Tx) GetActor() ([]byte, enum.Actor)
- func (t *Tx) GetOrCreateSunriseCounterparty(email, name string, auditLog *models.ComplianceAuditLog) (out *models.Counterparty, err error)
- func (t *Tx) LatestPayloadEnvelope(envelopeID uuid.UUID, direction enum.Direction) (env *models.SecureEnvelope, err error)
- func (t *Tx) LatestSecureEnvelope(envelopeID uuid.UUID, direction enum.Direction) (env *models.SecureEnvelope, err error)
- func (t *Tx) ListAPIKeys(page *models.PageInfo) (out *models.APIKeyPage, err error)
- func (t *Tx) ListAccountTransactions(accountID ulid.ULID, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
- func (t *Tx) ListAccounts(page *models.PageInfo) (out *models.AccountsPage, err error)
- func (t *Tx) ListComplianceAuditLogs(page *models.ComplianceAuditLogPageInfo) (out *models.ComplianceAuditLogPage, err error)
- func (t *Tx) ListContacts(counterparty any, page *models.PageInfo) (out *models.ContactsPage, err error)
- func (t *Tx) ListCounterparties(page *models.CounterpartyPageInfo) (out *models.CounterpartyPage, err error)
- func (t *Tx) ListCounterpartySourceInfo(source enum.Source) (out []*models.CounterpartySourceInfo, err error)
- func (t *Tx) ListCryptoAddresses(accountID ulid.ULID, page *models.PageInfo) (out *models.CryptoAddressPage, err error)
- func (tx *Tx) ListDaybreak() (out map[string]*models.CounterpartySourceInfo, err error)
- func (t *Tx) ListResetPasswordLinks(page *models.PageInfo) (out *models.ResetPasswordLinkPage, err error)
- func (t *Tx) ListSecureEnvelopes(txID uuid.UUID, page *models.PageInfo) (out *models.SecureEnvelopePage, err error)
- func (t *Tx) ListSunrise(page *models.PageInfo) (out *models.SunrisePage, err error)
- func (t *Tx) ListTransactions(page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
- func (t *Tx) ListUsers(page *models.UserPageInfo) (out *models.UserPage, err error)
- func (t *Tx) LookupAccount(cryptoAddress string) (account *models.Account, err error)
- func (t *Tx) LookupCounterparty(field, value string) (counterparty *models.Counterparty, err error)
- func (t *Tx) LookupRole(role string) (model *models.Role, err error)
- func (t *Tx) Query(query string, args ...any) (*sql.Rows, error)
- func (t *Tx) QueryRow(query string, args ...any) *sql.Row
- func (t *Tx) RetrieveAPIKey(clientIDOrKeyID any) (key *models.APIKey, err error)
- func (t *Tx) RetrieveAccount(accountID ulid.ULID) (account *models.Account, err error)
- func (t *Tx) RetrieveComplianceAuditLog(id ulid.ULID) (log *models.ComplianceAuditLog, err error)
- func (t *Tx) RetrieveContact(contactID, counterparty any) (contact *models.Contact, err error)
- func (t *Tx) RetrieveCounterparty(counterpartyID ulid.ULID) (counterparty *models.Counterparty, err error)
- func (t *Tx) RetrieveCryptoAddress(accountID, cryptoAddressID ulid.ULID) (addr *models.CryptoAddress, err error)
- func (t *Tx) RetrieveResetPasswordLink(linkID ulid.ULID) (link *models.ResetPasswordLink, err error)
- func (t *Tx) RetrieveSecureEnvelope(txID uuid.UUID, envID ulid.ULID) (env *models.SecureEnvelope, err error)
- func (t *Tx) RetrieveSunrise(sunriseID ulid.ULID) (msg *models.Sunrise, err error)
- func (t *Tx) RetrieveTransaction(transactionID uuid.UUID) (transaction *models.Transaction, err error)
- func (t *Tx) RetrieveUser(emailOrUserID any) (user *models.User, err error)
- func (t *Tx) Rollback() error
- func (t *Tx) SearchCounterparties(query *models.SearchQuery) (out *models.CounterpartyPage, err error)
- func (t *Tx) SetAPIKeyLastSeen(keyID ulid.ULID, lastSeen time.Time) (err error)
- func (t *Tx) SetActor(actorID []byte, actorType enum.Actor)
- func (t *Tx) SetUserLastLogin(userID ulid.ULID, lastLogin time.Time) (err error)
- func (t *Tx) SetUserPassword(userID ulid.ULID, password string) (err error)
- func (t *Tx) TransactionState(transactionID uuid.UUID) (archived bool, status enum.Status, err error)
- func (t *Tx) UnarchiveTransaction(transactionID uuid.UUID, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateAPIKey(key *models.APIKey, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateAccount(account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateContact(contact *models.Contact, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateCounterparty(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateCryptoAddress(addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateDaybreak(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateResetPasswordLink(link *models.ResetPasswordLink) (err error)
- func (t *Tx) UpdateSecureEnvelope(env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateSunrise(msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateSunriseStatus(txID uuid.UUID, status enum.Status, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateTransaction(transaction *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
- func (t *Tx) UpdateUser(user *models.User, auditLog *models.ComplianceAuditLog) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetThreshold ¶ added in v1.0.0
func GetThreshold() float64
GetThreshold returns the current threshold for the fuzzy search.
func IsURLCandidate ¶ added in v1.0.0
Returns true if the query value looks like a domain or a URL to match against a counterparty website or endpoint. This is not a strict URL check and may miss things that are valid URLs and catch things that are not; however it handles the most cases where http://example.com or example.com are passed in.
func NormURL ¶ added in v1.0.0
Normalize the URL to a domain name and port, stripping off the scheme and path if present. This is used to assist a like query in the database for URL lookup.
func Rank ¶ added in v1.0.0
Rank attempts to perform a substring match of the term on the query using unicode normalized case-insensitive fuzzy search. If the term is longer than the query then the query is matched to the term to find similarity regardless of substring containment. E.g. a query for example.com should match the example and a query for ample should match the same term. The distance and the similarity is returned.
func SetThreshold ¶ added in v1.0.0
func SetThreshold(t float64)
SetThreshold sets the threshold for the fuzzy search. The threshold must be a number between 0.0 and 1.0 where a higher threshold requires stricter matching. Setting a threshold of 0.0 will allow any rank fold matches.
Types ¶
type Migration ¶
type Migration struct {
ID int // The unique sequence ID of the migration
Name string // The human readable name of the migration
Version string // The package version when the migration was applied
Created time.Time // The timestamp when the migration was applied
Path string // The path of the migration in the filesystem
}
Migration is used to represent both a SQL migration from the embedded file system and a migration record in the database. These records are compared to ensure the database is as up to date as possible before the application starts.
func Migrations ¶
Migrations returns the migration files from the embedded file system.
type PreparedTransaction ¶
type PreparedTransaction struct {
// contains filtered or unexported fields
}
func (*PreparedTransaction) AddCounterparty ¶
func (p *PreparedTransaction) AddCounterparty(in *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
TODO: this method needs to be tested extensively!!
func (*PreparedTransaction) AddEnvelope ¶
func (p *PreparedTransaction) AddEnvelope(in *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
func (*PreparedTransaction) Commit ¶
func (p *PreparedTransaction) Commit() error
func (*PreparedTransaction) CreateSunrise ¶ added in v0.28.0
func (p *PreparedTransaction) CreateSunrise(in *models.Sunrise, auditLog *models.ComplianceAuditLog) error
func (*PreparedTransaction) Created ¶
func (p *PreparedTransaction) Created() bool
func (*PreparedTransaction) Fetch ¶
func (p *PreparedTransaction) Fetch() (transaction *models.Transaction, err error)
func (*PreparedTransaction) LookupCounterparty ¶ added in v0.30.0
func (p *PreparedTransaction) LookupCounterparty(field, value string) (*models.Counterparty, error)
func (*PreparedTransaction) Rollback ¶
func (p *PreparedTransaction) Rollback() error
func (*PreparedTransaction) Update ¶
func (p *PreparedTransaction) Update(in *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
func (*PreparedTransaction) UpdateCounterparty ¶ added in v0.28.0
func (p *PreparedTransaction) UpdateCounterparty(in *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*PreparedTransaction) UpdateSunrise ¶ added in v0.28.0
func (p *PreparedTransaction) UpdateSunrise(in *models.Sunrise, auditLog *models.ComplianceAuditLog) error
func (*PreparedTransaction) UpdateSunriseStatus ¶ added in v1.0.0
func (p *PreparedTransaction) UpdateSunriseStatus(txID uuid.UUID, status enum.Status, auditLog *models.ComplianceAuditLog) error
type SearchRank ¶ added in v1.0.0
type SearchRank struct {
// contains filtered or unexported fields
}
func NewSearchRank ¶ added in v1.0.0
func NewSearchRank(query string, limit int) *SearchRank
func (*SearchRank) Append ¶ added in v1.0.0
func (s *SearchRank) Append(item *RankItem) bool
func (*SearchRank) Results ¶ added in v1.0.0
func (s *SearchRank) Results() RankList
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the store.Store interface using SQLite3 as the storage backend.
func (*Store) ArchiveTransaction ¶ added in v0.29.0
func (*Store) CountTransactions ¶ added in v1.0.0
func (*Store) CreateAPIKey ¶
func (*Store) CreateAccount ¶
func (s *Store) CreateAccount(ctx context.Context, account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
Create an account and any crypto addresses associated with the account.
func (*Store) CreateComplianceAuditLog ¶ added in v1.1.0
func (*Store) CreateContact ¶ added in v0.28.0
func (*Store) CreateCounterparty ¶
func (s *Store) CreateCounterparty(ctx context.Context, counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) CreateCryptoAddress ¶
func (s *Store) CreateCryptoAddress(ctx context.Context, addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) CreateDaybreak ¶ added in v1.0.0
func (s *Store) CreateDaybreak(ctx context.Context, counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
Create the counterparty and any associated contacts in the database. If the counterparty already exists and it is a daybreak record, then the record will try to be fixed, otherwise an error will be returned; if a contact already exists associated with another counterparty, an error will be returned. The counterparty and all associated contacts will be created in a single transaction; if any contact fails to be created, the transaction will be rolled back and an error will be returned.
func (*Store) CreateResetPasswordLink ¶ added in v1.0.0
func (s *Store) CreateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) (err error)
Create a ResetPasswordLink record in the database. This method checks to see if there is an existing link for the user and if so, it will return ErrTooSoon if that link is not expired. If the link is expired, it will be deleted and a new one created.
func (*Store) CreateSecureEnvelope ¶
func (s *Store) CreateSecureEnvelope(ctx context.Context, env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) CreateSunrise ¶ added in v0.28.0
func (s *Store) CreateSunrise(ctx context.Context, msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
Create a sunrise message in the database.
func (*Store) CreateTransaction ¶
func (s *Store) CreateTransaction(ctx context.Context, transaction *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) CreateUser ¶
func (*Store) DeleteAPIKey ¶
func (*Store) DeleteAccount ¶
func (s *Store) DeleteAccount(ctx context.Context, accountID ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
Delete account and all associated crypto addresses
func (*Store) DeleteContact ¶ added in v0.28.0
func (s *Store) DeleteContact(ctx context.Context, contactID, counterparty any, auditLog *models.ComplianceAuditLog) (err error)
Delete contact associated with the specified counterparty. The counterparty can either be a ULID of the counterparty or a pointer to the Counterparty model. If the ID is specified then the associated counterparty is used to identify the contact to delete. If the model is specified, then the contact is deleted from the model as well.
func (*Store) DeleteCounterparty ¶
func (*Store) DeleteCryptoAddress ¶
func (*Store) DeleteDaybreak ¶ added in v1.0.0
func (s *Store) DeleteDaybreak(ctx context.Context, counterpartyID ulid.ULID, ignoreTxns bool, auditLog *models.ComplianceAuditLog) (err error)
Deletes the counterparty and any associated contacts in the database, unless the counterparty has transactions associated with it. If `ignoreTxns` is `true`, then it will delete the counterparty and contacts without checking for associated transactions. This function will return the `errors.ErrDaybreakHasTxns` error if trying to delete a Daybreak Counterparty with transactions associated to it in the database when `ignoreTxns` is not `true`. This function will only delete Counterparties with `source='daybreak'`.
func (*Store) DeleteResetPasswordLink ¶ added in v1.0.0
func (*Store) DeleteSecureEnvelope ¶
func (*Store) DeleteSunrise ¶ added in v0.28.0
func (s *Store) DeleteSunrise(ctx context.Context, id ulid.ULID, auditLog *models.ComplianceAuditLog) (err error)
Delete sunrise message from the database.
func (*Store) DeleteTransaction ¶
func (*Store) DeleteUser ¶
func (*Store) GetOrCreateSunriseCounterparty ¶ added in v0.28.0
func (s *Store) GetOrCreateSunriseCounterparty(ctx context.Context, email, name string, auditLog *models.ComplianceAuditLog) (out *models.Counterparty, err error)
Get or create a sunrise counterparty from an email address.
func (*Store) InitializeSchema ¶
Initialize schema applies any unapplied migrations to the database and should be run when the database is first connected to. If empty is true then the migration table is created and all migrations are applied. If it is not true then the current migration of the database is fetched and all unapplied migrations are applied.
This method is called on Open() and should not be directly applied by the user.
func (*Store) LatestPayloadEnvelope ¶ added in v0.24.0
func (*Store) LatestSecureEnvelope ¶ added in v0.14.0
func (*Store) ListAPIKeys ¶
func (*Store) ListAccountTransactions ¶ added in v1.0.0
func (s *Store) ListAccountTransactions(ctx context.Context, accountID ulid.ULID, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
List all transactions that have one of the account wallet addresses in either the originator or beneficiary wallet address fields.
func (*Store) ListAccounts ¶
func (s *Store) ListAccounts(ctx context.Context, page *models.PageInfo) (out *models.AccountsPage, err error)
Retrieve summary information for all accounts for the specified page, omitting crypto addresses and any other irrelevant information.
func (*Store) ListComplianceAuditLogs ¶ added in v1.1.0
func (s *Store) ListComplianceAuditLogs(ctx context.Context, page *models.ComplianceAuditLogPageInfo) (out *models.ComplianceAuditLogPage, err error)
func (*Store) ListContacts ¶ added in v0.28.0
func (s *Store) ListContacts(ctx context.Context, counterparty any, page *models.PageInfo) (out *models.ContactsPage, err error)
List contacts associated with the specified counterparty. The counterparty can either be a ULID of the counterparty ID or a pointer to the Counterparty model. If the ID is specified then the associated counterparty is retrieved from the database and attached to all returned contacts. If the model is specified, then the contacts, will be attached to the model.
func (*Store) ListCounterparties ¶
func (s *Store) ListCounterparties(ctx context.Context, page *models.CounterpartyPageInfo) (out *models.CounterpartyPage, err error)
func (*Store) ListCounterpartySourceInfo ¶
func (*Store) ListCryptoAddresses ¶
func (s *Store) ListCryptoAddresses(ctx context.Context, accountID ulid.ULID, page *models.PageInfo) (out *models.CryptoAddressPage, err error)
List crypto addresses associated with the specified accountID.
func (*Store) ListDaybreak ¶ added in v1.0.0
func (s *Store) ListDaybreak(ctx context.Context) (out map[string]*models.CounterpartySourceInfo, err error)
ListDaybreak returns a map of all the daybreak counterparty sources in the database in order to match the directory ID to the internal database record ID.
func (*Store) ListResetPasswordLinks ¶ added in v1.0.0
func (*Store) ListSecureEnvelopes ¶
func (*Store) ListSunrise ¶ added in v0.28.0
func (s *Store) ListSunrise(ctx context.Context, page *models.PageInfo) (out *models.SunrisePage, err error)
Retrieve sunrise messages from the database and return them as a paginated list.
func (*Store) ListTransactions ¶
func (s *Store) ListTransactions(ctx context.Context, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
func (*Store) LookupAccount ¶ added in v1.0.0
func (s *Store) LookupAccount(ctx context.Context, cryptoAddress string) (account *models.Account, err error)
Lookup an account by an associated crypto address.
func (*Store) LookupCounterparty ¶
func (*Store) LookupRole ¶ added in v0.18.0
func (*Store) PrepareTransaction ¶
func (s *Store) PrepareTransaction(ctx context.Context, envelopeID uuid.UUID, auditLog *models.ComplianceAuditLog) (_ models.PreparedTransaction, err error)
func (*Store) RetrieveAPIKey ¶
func (*Store) RetrieveAccount ¶
func (s *Store) RetrieveAccount(ctx context.Context, accountID ulid.ULID) (account *models.Account, err error)
Retrieve account detail information including all associated crypto addresses.
func (*Store) RetrieveComplianceAuditLog ¶ added in v1.1.0
func (*Store) RetrieveContact ¶ added in v0.28.0
func (s *Store) RetrieveContact(ctx context.Context, contactID, counterparty any) (contact *models.Contact, err error)
Retrieve the contact with the specified ID and associate it with the specified counterparty. The counterparty can either be the ULID of the counterparty or a pointer to the Counterparty model. If the ID is specified then the associated counterparty is retrieved from the database and attached to the contact. Note that if a pointer to the Counterparty model is specified, it is not modified in place.
func (*Store) RetrieveCounterparty ¶
func (*Store) RetrieveCryptoAddress ¶
func (*Store) RetrieveResetPasswordLink ¶ added in v1.0.0
func (s *Store) RetrieveResetPasswordLink(ctx context.Context, linkID ulid.ULID) (link *models.ResetPasswordLink, err error)
Retrieve a ResetPasswordLink in the database by its ID.
func (*Store) RetrieveSecureEnvelope ¶
func (*Store) RetrieveSunrise ¶ added in v0.28.0
Retrieve sunrise message detail information.
func (*Store) RetrieveTransaction ¶
func (s *Store) RetrieveTransaction(ctx context.Context, id uuid.UUID) (transaction *models.Transaction, err error)
Retrieve a transaction record by its ID and any related secure envelopes.
func (*Store) RetrieveUser ¶
func (*Store) SearchCounterparties ¶ added in v0.23.0
func (s *Store) SearchCounterparties(ctx context.Context, query *models.SearchQuery) (out *models.CounterpartyPage, err error)
SearchCounterparties uses an in-memory fuzzy search to find counterparties whose name matches the query using a unicode normalization, case-insensitive method. Additionally, if the query looks like a URL, it will also search for counterparties whose website or endpoint matches the query. The results are sorted by the distance of the match, with the closest matches first. The results are limited to the number of results specified in the query. Note that this in-memory fuzzy search is required for SQLite since there is no native search in SQLite without an extension.
func (*Store) SetAPIKeyLastSeen ¶ added in v1.2.0
func (*Store) SetUserLastLogin ¶ added in v0.18.0
func (*Store) SetUserPassword ¶
func (*Store) TransactionState ¶ added in v1.0.0
func (*Store) UnarchiveTransaction ¶ added in v1.0.0
func (*Store) UpdateAPIKey ¶
func (s *Store) UpdateAPIKey(ctx context.Context, key *models.APIKey, auditLog *models.ComplianceAuditLog) (err error)
NOTE: the only thing that can be updated on an api key right now is last_seen
func (*Store) UpdateAccount ¶
func (s *Store) UpdateAccount(ctx context.Context, account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
Update account information; ignores any associated crypto addresses.
func (*Store) UpdateContact ¶ added in v0.28.0
func (*Store) UpdateCounterparty ¶
func (s *Store) UpdateCounterparty(ctx context.Context, counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) UpdateCryptoAddress ¶
func (s *Store) UpdateCryptoAddress(ctx context.Context, addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) UpdateDaybreak ¶ added in v1.0.0
func (s *Store) UpdateDaybreak(ctx context.Context, counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
Updates the counterparty and any associated contacts in the database. All of the contacts will be be created or updated in this transaction. If a contact already exists associated with another counterparty, then it will be updated to use this counterparty. If any contact fails to be created or updated, the transaction will be rolled back and an error will be returned.
func (*Store) UpdateResetPasswordLink ¶ added in v1.0.0
func (s *Store) UpdateResetPasswordLink(ctx context.Context, link *models.ResetPasswordLink) (err error)
Update a ResetPasswordLink record. Only updates the Signature, SentOn, VerifiedOn, and Modified fields.
func (*Store) UpdateSecureEnvelope ¶
func (s *Store) UpdateSecureEnvelope(ctx context.Context, env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) UpdateSunrise ¶ added in v0.28.0
func (s *Store) UpdateSunrise(ctx context.Context, msg *models.Sunrise, auditLog *models.ComplianceAuditLog) (err error)
Update sunrise message information.
func (*Store) UpdateSunriseStatus ¶ added in v1.0.0
func (*Store) UpdateTransaction ¶
func (s *Store) UpdateTransaction(ctx context.Context, t *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
func (*Store) UpdateUser ¶
func (*Store) UseTravelAddressFactory ¶
func (s *Store) UseTravelAddressFactory(f models.TravelAddressFactory)
type Tx ¶ added in v1.1.0
type Tx struct {
// contains filtered or unexported fields
}
Tx implements the store.Tx interface using SQLite3 as the storage backend.
func (*Tx) ArchiveTransaction ¶ added in v1.1.0
func (*Tx) CountTransactions ¶ added in v1.1.0
func (t *Tx) CountTransactions() (counts *models.TransactionCounts, err error)
func (*Tx) CreateAPIKey ¶ added in v1.1.0
func (*Tx) CreateAccount ¶ added in v1.1.0
func (t *Tx) CreateAccount(account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
Create an account and any crypto addresses associated with the account.
func (*Tx) CreateComplianceAuditLog ¶ added in v1.1.0
func (t *Tx) CreateComplianceAuditLog(log *models.ComplianceAuditLog) (err error)
func (*Tx) CreateContact ¶ added in v1.1.0
func (*Tx) CreateCounterparty ¶ added in v1.1.0
func (t *Tx) CreateCounterparty(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) CreateCryptoAddress ¶ added in v1.1.0
func (t *Tx) CreateCryptoAddress(addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) CreateDaybreak ¶ added in v1.1.0
func (t *Tx) CreateDaybreak(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) CreateResetPasswordLink ¶ added in v1.1.0
func (t *Tx) CreateResetPasswordLink(link *models.ResetPasswordLink) (err error)
Create a ResetPasswordLink record in the database. This method checks to see if there is an existing link for the user and if so, it will return ErrTooSoon if that link is not expired. If the link is expired, it will be deleted and a new one created.
func (*Tx) CreateSecureEnvelope ¶ added in v1.1.0
func (t *Tx) CreateSecureEnvelope(env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) CreateSunrise ¶ added in v1.1.0
Create a sunrise message in the database.
func (*Tx) CreateTransaction ¶ added in v1.1.0
func (t *Tx) CreateTransaction(transaction *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) CreateUser ¶ added in v1.1.0
func (*Tx) DeleteAPIKey ¶ added in v1.1.0
func (*Tx) DeleteAccount ¶ added in v1.1.0
Delete account and all associated crypto addresses
func (*Tx) DeleteContact ¶ added in v1.1.0
func (t *Tx) DeleteContact(contactID, counterparty any, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) DeleteCounterparty ¶ added in v1.1.0
func (*Tx) DeleteCryptoAddress ¶ added in v1.1.0
func (*Tx) DeleteDaybreak ¶ added in v1.1.0
func (*Tx) DeleteResetPasswordLink ¶ added in v1.1.0
func (*Tx) DeleteSecureEnvelope ¶ added in v1.1.0
func (*Tx) DeleteSunrise ¶ added in v1.1.0
Delete sunrise message from the database.
func (*Tx) DeleteTransaction ¶ added in v1.1.0
func (*Tx) DeleteUser ¶ added in v1.1.0
func (*Tx) GetActor ¶ added in v1.2.0
Returns the actor metadata set by Tx.SetActor, or from the context in Store.BeginTx.
func (*Tx) GetOrCreateSunriseCounterparty ¶ added in v1.1.0
func (t *Tx) GetOrCreateSunriseCounterparty(email, name string, auditLog *models.ComplianceAuditLog) (out *models.Counterparty, err error)
func (*Tx) LatestPayloadEnvelope ¶ added in v1.1.0
func (*Tx) LatestSecureEnvelope ¶ added in v1.1.0
func (*Tx) ListAPIKeys ¶ added in v1.1.0
func (*Tx) ListAccountTransactions ¶ added in v1.1.0
func (t *Tx) ListAccountTransactions(accountID ulid.ULID, page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
List all transactions that have one of the account wallet addresses in either the originator or beneficiary wallet address fields.
func (*Tx) ListAccounts ¶ added in v1.1.0
Retrieve summary information for all accounts for the specified page, omitting crypto addresses and any other irrelevant information.
func (*Tx) ListComplianceAuditLogs ¶ added in v1.1.0
func (t *Tx) ListComplianceAuditLogs(page *models.ComplianceAuditLogPageInfo) (out *models.ComplianceAuditLogPage, err error)
func (*Tx) ListContacts ¶ added in v1.1.0
func (*Tx) ListCounterparties ¶ added in v1.1.0
func (t *Tx) ListCounterparties(page *models.CounterpartyPageInfo) (out *models.CounterpartyPage, err error)
func (*Tx) ListCounterpartySourceInfo ¶ added in v1.1.0
func (*Tx) ListCryptoAddresses ¶ added in v1.1.0
func (t *Tx) ListCryptoAddresses(accountID ulid.ULID, page *models.PageInfo) (out *models.CryptoAddressPage, err error)
List crypto addresses associated with the specified accountID.
func (*Tx) ListDaybreak ¶ added in v1.1.0
func (tx *Tx) ListDaybreak() (out map[string]*models.CounterpartySourceInfo, err error)
ListDaybreak returns a map of all the daybreak counterparty sources in the database in order to match the directory ID to the internal database record ID.
func (*Tx) ListResetPasswordLinks ¶ added in v1.1.0
func (*Tx) ListSecureEnvelopes ¶ added in v1.1.0
func (*Tx) ListSunrise ¶ added in v1.1.0
func (*Tx) ListTransactions ¶ added in v1.1.0
func (t *Tx) ListTransactions(page *models.TransactionPageInfo) (out *models.TransactionPage, err error)
func (*Tx) LookupAccount ¶ added in v1.1.0
Lookup an account by an associated crypto address.
func (*Tx) LookupCounterparty ¶ added in v1.1.0
func (t *Tx) LookupCounterparty(field, value string) (counterparty *models.Counterparty, err error)
func (*Tx) LookupRole ¶ added in v1.1.0
func (*Tx) RetrieveAPIKey ¶ added in v1.1.0
func (*Tx) RetrieveAccount ¶ added in v1.1.0
Retrieve account detail information including all associated crypto addresses.
func (*Tx) RetrieveComplianceAuditLog ¶ added in v1.1.0
func (*Tx) RetrieveContact ¶ added in v1.1.0
func (*Tx) RetrieveCounterparty ¶ added in v1.1.0
func (*Tx) RetrieveCryptoAddress ¶ added in v1.1.0
func (*Tx) RetrieveResetPasswordLink ¶ added in v1.1.0
func (t *Tx) RetrieveResetPasswordLink(linkID ulid.ULID) (link *models.ResetPasswordLink, err error)
Retrieve a ResetPasswordLink in the database by its ID.
func (*Tx) RetrieveSecureEnvelope ¶ added in v1.1.0
func (*Tx) RetrieveSunrise ¶ added in v1.1.0
Retrieve sunrise message detail information.
func (*Tx) RetrieveTransaction ¶ added in v1.1.0
func (t *Tx) RetrieveTransaction(transactionID uuid.UUID) (transaction *models.Transaction, err error)
Retrieve a transaction record by its ID and any related secure envelopes.
func (*Tx) RetrieveUser ¶ added in v1.1.0
func (*Tx) SearchCounterparties ¶ added in v1.1.0
func (t *Tx) SearchCounterparties(query *models.SearchQuery) (out *models.CounterpartyPage, err error)
func (*Tx) SetAPIKeyLastSeen ¶ added in v1.2.0
func (*Tx) SetActor ¶ added in v1.2.0
Sets the actor metadata to be returned by Tx.GetActor.
func (*Tx) SetUserLastLogin ¶ added in v1.1.0
func (*Tx) SetUserPassword ¶ added in v1.1.0
func (*Tx) TransactionState ¶ added in v1.1.0
func (*Tx) UnarchiveTransaction ¶ added in v1.1.0
func (*Tx) UpdateAPIKey ¶ added in v1.1.0
NOTE: the only thing that can be updated on an api key right now is last_seen
func (*Tx) UpdateAccount ¶ added in v1.1.0
func (t *Tx) UpdateAccount(account *models.Account, auditLog *models.ComplianceAuditLog) (err error)
Update account information; ignores any associated crypto addresses.
func (*Tx) UpdateContact ¶ added in v1.1.0
func (*Tx) UpdateCounterparty ¶ added in v1.1.0
func (t *Tx) UpdateCounterparty(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) UpdateCryptoAddress ¶ added in v1.1.0
func (t *Tx) UpdateCryptoAddress(addr *models.CryptoAddress, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) UpdateDaybreak ¶ added in v1.1.0
func (t *Tx) UpdateDaybreak(counterparty *models.Counterparty, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) UpdateResetPasswordLink ¶ added in v1.1.0
func (t *Tx) UpdateResetPasswordLink(link *models.ResetPasswordLink) (err error)
Update a ResetPasswordLink record. Only updates the Signature, SentOn, VerifiedOn, and Modified fields.
func (*Tx) UpdateSecureEnvelope ¶ added in v1.1.0
func (t *Tx) UpdateSecureEnvelope(env *models.SecureEnvelope, auditLog *models.ComplianceAuditLog) (err error)
func (*Tx) UpdateSunrise ¶ added in v1.1.0
Update sunrise message information.
func (*Tx) UpdateSunriseStatus ¶ added in v1.1.0
func (*Tx) UpdateTransaction ¶ added in v1.1.0
func (t *Tx) UpdateTransaction(transaction *models.Transaction, auditLog *models.ComplianceAuditLog) (err error)