db

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package db provides the database interface for the screener-api.

Package db provides the database interface for the screener-api.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAddressNotCached = errors.New("address not cached")

ErrNoAddressNotCached is returned when an address is not cached.

Functions

This section is empty.

Types

type AddressIndicators

type AddressIndicators struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	// Address is the address to be screened
	Address string `gorm:"column:address;primary_key"`
	// RiskIndicators is the list of categories for the address
	Indicators addressRiskIndicators `gorm:"column:indicators"`
}

AddressIndicators is the address indicators for a given address.

func MakeRecord

func MakeRecord(address string, records []trmlabs.AddressRiskIndicator) *AddressIndicators

MakeRecord creates a new address indicators record.

type RuleDB

type RuleDB interface {
	RuleWriterDB
	RuleReaderDB
}

RuleDB is the interface for reading and writing rules to the database.

type RuleReaderDB

type RuleReaderDB interface {
	GetAddressIndicators(ctx context.Context, address string, since time.Time) ([]trmlabs.AddressRiskIndicator, error)
}

RuleReaderDB is the interface for reading rules from the database.

type RuleWriterDB

type RuleWriterDB interface {
	PutAddressIndicators(ctx context.Context, address string, riskIndicator []trmlabs.AddressRiskIndicator) error
}

RuleWriterDB is the interface for writing rules to the database.

Directories

Path Synopsis
sql
Package sql provides a sql store for the screener-api.
Package sql provides a sql store for the screener-api.
base
Package base provides a base store for the screener-api.
Package base provides a base store for the screener-api.
mysql
Package mysql provides a mysql store for the screener-api.
Package mysql provides a mysql store for the screener-api.
sqlite
Package sqlite provides a sqlite store for the screener-api.
Package sqlite provides a sqlite store for the screener-api.

Jump to

Keyboard shortcuts

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