sqltypes

package
v0.0.0-...-613d1fa Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetadataToCommonType

func MetadataToCommonType(metadata *Metadata) *types.Metadata

func MiniHeaderToCommonType

func MiniHeaderToCommonType(miniHeader *MiniHeader) *types.MiniHeader

func MiniHeadersToCommonType

func MiniHeadersToCommonType(miniHeaders []*MiniHeader) []*types.MiniHeader

func OrderToCommonType

func OrderToCommonType(order *Order) *types.OrderWithMetadata

func OrdersToCommonType

func OrdersToCommonType(orders []*Order) []*types.OrderWithMetadata

func ParsedAssetDataToCommonType

func ParsedAssetDataToCommonType(parsedAssetData *ParsedAssetData) []*types.SingleAssetData

func SingleAssetDataToCommonType

func SingleAssetDataToCommonType(singleAssetData *SingleAssetData) *types.SingleAssetData

Types

type BigInt

type BigInt struct {
	*big.Int
}

BigInt is a wrapper around *big.Int that implements the sql.Valuer and sql.Scanner interfaces and *does not* retain sort order.

func BigIntFromInt64

func BigIntFromInt64(v int64) *BigInt

func BigIntFromString

func BigIntFromString(v string) (*BigInt, error)

func NewBigInt

func NewBigInt(v *big.Int) *BigInt

func (*BigInt) MarshalJSON

func (i *BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) Scan

func (i *BigInt) Scan(value interface{}) error

func (*BigInt) UnmarshalJSON

func (i *BigInt) UnmarshalJSON(data []byte) error

func (*BigInt) Value

func (i *BigInt) Value() (driver.Value, error)

type EventLogs

type EventLogs struct {
	Logs []ethtypes.Log
}

EventLogs is a wrapper around []*ethtypes.Log that implements the sql.Valuer and sql.Scanner interfaces.

func NewEventLogs

func NewEventLogs(logs []ethtypes.Log) *EventLogs

func (*EventLogs) Scan

func (e *EventLogs) Scan(value interface{}) error

func (*EventLogs) Value

func (e *EventLogs) Value() (driver.Value, error)

type Metadata

type Metadata struct {
	EthereumChainID                   int       `db:"ethereumChainID"`
	EthRPCRequestsSentInCurrentUTCDay int       `db:"ethRPCRequestsSentInCurrentUTCDay"`
	StartOfCurrentUTCDay              time.Time `db:"startOfCurrentUTCDay"`
}

func MetadataFromCommonType

func MetadataFromCommonType(metadata *types.Metadata) *Metadata

type MiniHeader

type MiniHeader struct {
	Hash      common.Hash   `db:"hash"`
	Parent    common.Hash   `db:"parent"`
	Number    *SortedBigInt `db:"number"`
	Timestamp time.Time     `db:"timestamp"`
	Logs      *EventLogs    `db:"logs"`
}

func MiniHeaderFromCommonType

func MiniHeaderFromCommonType(miniHeader *types.MiniHeader) *MiniHeader

func MiniHeadersFromCommonType

func MiniHeadersFromCommonType(miniHeaders []*types.MiniHeader) []*MiniHeader

type Order

type Order struct {
	Hash                     common.Hash      `db:"hash"`
	ChainID                  *SortedBigInt    `db:"chainID"`
	ExchangeAddress          common.Address   `db:"exchangeAddress"`
	MakerAddress             common.Address   `db:"makerAddress"`
	MakerAssetData           []byte           `db:"makerAssetData"`
	MakerFeeAssetData        []byte           `db:"makerFeeAssetData"`
	MakerAssetAmount         *SortedBigInt    `db:"makerAssetAmount"`
	MakerFee                 *SortedBigInt    `db:"makerFee"`
	TakerAddress             common.Address   `db:"takerAddress"`
	TakerAssetData           []byte           `db:"takerAssetData"`
	TakerFeeAssetData        []byte           `db:"takerFeeAssetData"`
	TakerAssetAmount         *SortedBigInt    `db:"takerAssetAmount"`
	TakerFee                 *SortedBigInt    `db:"takerFee"`
	SenderAddress            common.Address   `db:"senderAddress"`
	FeeRecipientAddress      common.Address   `db:"feeRecipientAddress"`
	ExpirationTimeSeconds    *SortedBigInt    `db:"expirationTimeSeconds"`
	Salt                     *SortedBigInt    `db:"salt"`
	Signature                []byte           `db:"signature"`
	LastUpdated              time.Time        `db:"lastUpdated"`
	FillableTakerAssetAmount *SortedBigInt    `db:"fillableTakerAssetAmount"`
	IsRemoved                bool             `db:"isRemoved"`
	IsPinned                 bool             `db:"isPinned"`
	ParsedMakerAssetData     *ParsedAssetData `db:"parsedMakerAssetData"`
	ParsedMakerFeeAssetData  *ParsedAssetData `db:"parsedMakerFeeAssetData"`
	LastValidatedBlockNumber *SortedBigInt    `db:"lastValidatedBlockNumber"`
	LastValidatedBlockHash   common.Hash      `db:"lastValidatedBlockHash"`
}

Order is the SQL database representation a 0x order along with some relevant metadata.

func OrderFromCommonType

func OrderFromCommonType(order *types.OrderWithMetadata) *Order

func OrdersFromCommonType

func OrdersFromCommonType(orders []*types.OrderWithMetadata) []*Order

type ParsedAssetData

type ParsedAssetData []*SingleAssetData

ParsedAssetData is a wrapper around []*SingleAssetData that implements the sql.Valuer and sql.Scanner interfaces.

func ParsedAssetDataFromCommonType

func ParsedAssetDataFromCommonType(parsedAssetData []*types.SingleAssetData) *ParsedAssetData

func (*ParsedAssetData) Scan

func (s *ParsedAssetData) Scan(value interface{}) error

func (*ParsedAssetData) Value

func (s *ParsedAssetData) Value() (driver.Value, error)

type SingleAssetData

type SingleAssetData struct {
	Address common.Address `json:"address"`
	TokenID *BigInt        `json:"tokenID"`
}

func SingleAssetDataFromCommonType

func SingleAssetDataFromCommonType(singleAssetData *types.SingleAssetData) *SingleAssetData

type SortedBigInt

type SortedBigInt struct {
	*big.Int
}

SortedBigInt is a wrapper around *big.Int that implements the sql.Valuer and sql.Scanner interfaces and retains sort order by padding with zeroes.

func NewSortedBigInt

func NewSortedBigInt(v *big.Int) *SortedBigInt

func SortedBigIntFromInt64

func SortedBigIntFromInt64(v int64) *SortedBigInt

func SortedBigIntFromString

func SortedBigIntFromString(v string) (*SortedBigInt, error)

func (*SortedBigInt) MarshalJSON

func (i *SortedBigInt) MarshalJSON() ([]byte, error)

func (*SortedBigInt) Scan

func (i *SortedBigInt) Scan(value interface{}) error

func (*SortedBigInt) UnmarshalJSON

func (i *SortedBigInt) UnmarshalJSON(data []byte) error

func (*SortedBigInt) Value

func (i *SortedBigInt) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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