sqlsol

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

This package defines our Solidity to SQL relational database mapping layer which aims to describe tables realised as a projection of all EVM Log events emitted by the chain.

Index

Constants

View Source
const (
	BytesToBytes = iota
	BytesToString
	BytesToHex
)

Variables

This section is empty.

Functions

func GenerateSpecFromAbis added in v0.28.0

func GenerateSpecFromAbis(spec *abi.Spec) ([]*types.EventClass, error)

GenerateSpecFromAbis creates a simple spec which just logs all events

func ValidateJSONSpec added in v0.28.0

func ValidateJSONSpec(bs []byte) error

Types

type BlockData

type BlockData struct {
	Data types.EventData
}

BlockData contains EventData definition

func NewBlockData

func NewBlockData(height uint64) *BlockData

NewBlockData returns a pointer to an empty BlockData structure

func (*BlockData) AddRow

func (b *BlockData) AddRow(tableName string, row types.EventDataRow)

AddRow appends a row to a specific table name in structure

func (*BlockData) GetRows

func (b *BlockData) GetRows(tableName string) (types.EventDataTable, error)

GetRows gets data rows for a given table name from structure

type BytesMapping added in v0.30.5

type BytesMapping int

type Projection

type Projection struct {
	Tables types.EventTables
	Spec   types.ProjectionSpec
}

Projection contains EventTable, Event & Abi specifications

func NewProjection added in v0.28.0

func NewProjection(spec types.ProjectionSpec) (*Projection, error)

Takes a sqlsol event specification and returns a pointer to a filled projection structure that contains event types mapped to SQL column types and Event tables structures with table and columns info

func NewProjectionFromBytes

func NewProjectionFromBytes(bs []byte) (*Projection, error)

NewProjectionFromBytes creates a Projection from a stream of bytes

func NewProjectionFromFolder

func NewProjectionFromFolder(specFileOrDirs ...string) (*Projection, error)

NewProjectionFromFolder creates a Projection from a folder containing spec files

func SpecLoader

func SpecLoader(specFileOrDirs []string, opts SpecOpt) (*Projection, error)

SpecLoader loads spec files and parses them

func (*Projection) GetColumn

func (p *Projection) GetColumn(tableName, columnName string) (*types.SQLTableColumn, error)

Get the column for a particular table and column name

type SpecOpt added in v0.26.0

type SpecOpt uint64
const (
	Block SpecOpt = 1 << iota
	Tx
)
const (
	None    SpecOpt = 0
	BlockTx         = Block | Tx
)

func (SpecOpt) Enabled added in v0.28.0

func (so SpecOpt) Enabled(opt SpecOpt) bool

Jump to

Keyboard shortcuts

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