db

package
v0.0.0-...-5845185 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() (*gorm.DB, error)

Connect - Attempt to connect to database, then try to run migration which will create all tables if not existing already

Types

type EventLogs

type EventLogs struct {
	BlockHash       string         `gorm:"column:blockhash;type:char(66);not null;primaryKey"`
	Index           uint           `gorm:"column:index;type:integer;not null;primaryKey"`
	Origin          string         `gorm:"column:origin;type:char(42);not null;index"`
	Topics          pq.StringArray `gorm:"column:topics;type:text[];not null;index:,type:gin"`
	Data            []byte         `gorm:"column:data;type:bytea"`
	TransactionHash string         `gorm:"column:txhash;type:char(66);not null;index"`
	BlockNumber     uint64         `gorm:"column:blocknumber;type:bigint;not null;index"`
}

EventLogs - Received/ fetched event logs, emitted by smart contract interaction(s)

func (EventLogs) TableName

func (EventLogs) TableName() string

TableName - Overriding default table name

type TaskResults

type TaskResults struct {
	BlockHash string    `gorm:"column:blockhash;type:char(66);not null;primaryKey"`
	Index     uint      `gorm:"column:index;type:integer;not null;primaryKey"`
	ID        string    `gorm:"column:id;type:uuid;not null;primaryKey"`
	EventLogs EventLogs `gorm:"foreignKey:blockhash,index;references:blockhash,index;constraint:OnDelete:CASCADE"`
	Tasks     Tasks     `gorm:"foreignKey:id;references:id"`
}

TaskResults - Stored job results

func (TaskResults) TableName

func (TaskResults) TableName() string

TableName - Overriding default table name

type Tasks

type Tasks struct {
	ID         string    `gorm:"column:id;type:uuid;default:gen_random_uuid();primaryKey"`
	Client     string    `gorm:"column:client;type:char(66);not null;index"`
	StartBlock uint64    `gorm:"column:startblock;type:bigint;not null;index"`
	Contract   string    `gorm:"column:contract;type:char(66);index"`
	Topic0     string    `gorm:"column:topic0;type:char(66);index"`
	Topic1     string    `gorm:"column:topic1;type:char(66);index"`
	Topic2     string    `gorm:"column:topic2;type:char(66);index"`
	Topic3     string    `gorm:"column:topic3;type:char(66);index"`
	TimeStamp  time.Time `gorm:"column:ts;type:timestamp;not null"`
	Enabled    bool      `gorm:"column:enabled;type:boolean;default:true;index"`
	Users      Users     `gorm:"foreignKey:client;references:apikey"`
}

Tasks - Submitted job tracker table schema

func (Tasks) TableName

func (Tasks) TableName() string

TableName - Overriding default table name

type Users

type Users struct {
	APIKey    string    `gorm:"column:apikey;type:char(66);primaryKey"`
	Address   string    `gorm:"column:address;type:char(42);not null;index"`
	TimeStamp time.Time `gorm:"column:ts;type:timestamp;not null"`
	Enabled   bool      `gorm:"column:enabled;type:boolean;default:true"`
}

Users - Users table definition

func (Users) TableName

func (Users) TableName() string

TableName - Overriding default table name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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