names

package
v0.0.0-...-3f8eaf4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Overview

Package names caries the names database

Index

Constants

View Source
const (
	NameReaderTab nameReaderMode = iota
	NameReaderComma
)
View Source
const (
	NameWriterCsv nameWriterFormat = iota
	NameWriterTsv
)

Variables

This section is empty.

Functions

func ClearCache

func ClearCache()

ClearCache removes names that are cached in-memory

func CreateName

func CreateName(dbType DatabaseType, chain string, name *types.SimpleName) (err error)

func LoadNamesArray

func LoadNamesArray(chain string, parts Parts, sortBy SortBy, terms []string) ([]types.SimpleName, error)

LoadNamesArray loads the names from the cache and returns an array of names

func LoadNamesMap

func LoadNamesMap(chain string, parts Parts, terms []string) (map[base.Address]types.SimpleName, error)

LoadNamesMap loads the names from the cache and returns a map of names

func ReadName

func ReadName(dbType DatabaseType, chain string, address base.Address) (name *types.SimpleName)

func RemoveName

func RemoveName(dbType DatabaseType, chain string, address base.Address) (name *types.SimpleName, err error)

func SetDeleted

func SetDeleted(dbType DatabaseType, chain string, address base.Address, deleted bool) (name *types.SimpleName, err error)

func UpdateName

func UpdateName(dbType DatabaseType, chain string, name *types.SimpleName) (err error)

func WriteNames

func WriteNames(dbType DatabaseType, chain string, dryRun bool) (err error)

Types

type DatabaseType

type DatabaseType string
const (
	DatabaseRegular DatabaseType = "names.tab"
	DatabaseCustom  DatabaseType = "names_custom.tab"
	DatabasePrefund DatabaseType = "allocs.csv"
	DatabaseDryRun  DatabaseType = "<dryrun>"
)

type NameReader

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

func NewNameReader

func NewNameReader(source io.Reader, mode nameReaderMode) (NameReader, error)

func (*NameReader) Read

func (gr *NameReader) Read() (types.SimpleName, error)

type NameWriter

type NameWriter struct {
	WriteHeader bool
	Format      nameWriterFormat
	Header      []string
	// contains filtered or unexported fields
}

func NewNameWriter

func NewNameWriter(destWriter io.Writer) *NameWriter

func (*NameWriter) Error

func (w *NameWriter) Error() error

func (*NameWriter) Flush

func (w *NameWriter) Flush()

func (*NameWriter) Write

func (w *NameWriter) Write(name *types.SimpleName) (err error)

type Parts

type Parts int
const (
	None      Parts = 0x0
	Regular   Parts = 0x1
	Custom    Parts = 0x2
	Prefund   Parts = 0x4
	Baddress  Parts = 0x8
	Testing   Parts = 0x10
	MatchCase Parts = 0x20
	Expanded  Parts = 0x40
	Tags      Parts = 0x80
)

Parts is a bitfield that defines what parts of a name to return and other options

type SortBy

type SortBy int
const (
	SortByAddress SortBy = iota
	SortByName
	// SortBySymbol
	// SortBySource
	// SortByDecimals
	SortByTags
)

SortBy is a bitfield that defines how to sort the names

Jump to

Keyboard shortcuts

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