db

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 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 BlacklistedAddress added in v0.4.0

type BlacklistedAddress struct {
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`

	Type    string `gorm:"column:type"           json:"type"`
	ID      string `gorm:"column:id;primary_key" json:"id"`
	Data    string `gorm:"column:data"           json:"data"`
	Address string `gorm:"column:address"        json:"address"`
	Network string `gorm:"column:network"        json:"network"`
	Tag     string `gorm:"column:tag"            json:"tag"`
	Remark  string `gorm:"column:remark"         json:"remark"`
}

BlacklistedAddress is a blacklisted address.

type BlacklistedAddressDB added in v0.4.0

type BlacklistedAddressDB interface {
	BlacklistedAddressWriterDB
	BlacklistedAddressReaderDB
}

BlacklistedAddressDB is the interface for reading and writing blacklisted addresses to the database.

type BlacklistedAddressReaderDB added in v0.4.0

type BlacklistedAddressReaderDB interface {
	GetBlacklistedAddress(ctx context.Context, address string) (*BlacklistedAddress, error)
}

BlacklistedAddressReaderDB provides methods to read blacklisted addresses from the database.

type BlacklistedAddressWriterDB added in v0.4.0

type BlacklistedAddressWriterDB interface {
	PutBlacklistedAddress(ctx context.Context, body BlacklistedAddress) error
	DeleteBlacklistedAddress(ctx context.Context, id string) error
	UpdateBlacklistedAddress(ctx context.Context, id string, body BlacklistedAddress) error
}

BlacklistedAddressWriterDB provides methods to write blacklisted addresses to the database.

type DB added in v0.4.0

type DB interface {
	BlacklistedAddressDB
	RuleDB
}

DB is the general database interface for the screener-api.

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