controllers

package
v1.0.0-beta-1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectReadQueryMetric

func CollectReadQueryMetric(ctx context.Context, statement string, config formatter.FormatConfig, took time.Duration)

CollectReadQueryMetric collects read query metric. It is used for JSON-RPC service. When that is deleted we can make this private.

func HealthHandler

func HealthHandler(w http.ResponseWriter, _ *http.Request)

HealthHandler serves health check requests.

Types

type Attribute

type Attribute struct {
	DisplayType string      `json:"display_type,omitempty"`
	TraitType   string      `json:"trait_type"`
	Value       interface{} `json:"value"`
}

Attribute is a single entry in the "attributes" field of Metadata.

type AttributeConfig

type AttributeConfig struct {
	Column      string `query:"column"`
	DisplayType string `query:"display_type"`
	TraitType   string `query:"trait_type"`
}

AttributeConfig provides formatting for a column used to drive an Attribute when using format=erc721 query param.

type Controller

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

Controller defines the HTTP handlers for interacting with user tables.

func NewController

func NewController(runner SQLRunner, svc system.SystemService) *Controller

NewController creates a new Controller.

func (*Controller) GetReceiptByTransactionHash

func (c *Controller) GetReceiptByTransactionHash(rw http.ResponseWriter, r *http.Request)

GetReceiptByTransactionHash handles request asking for a transaction receipt.

func (*Controller) GetSchemaByTableName

func (c *Controller) GetSchemaByTableName(rw http.ResponseWriter, r *http.Request)

GetSchemaByTableName handles the GET /schema/{table_name} call. TODO(json-rpc): delete when droppping support.

func (*Controller) GetTable

func (c *Controller) GetTable(rw http.ResponseWriter, r *http.Request)

GetTable handles the GET /chain/{chainID}/tables/{tableId} call.

func (*Controller) GetTableQuery

func (c *Controller) GetTableQuery(rw http.ResponseWriter, r *http.Request)

GetTableQuery handles the GET /query?s=[statement] call. Use mode=columns|rows|json|lines query param to control output format.

func (*Controller) GetTableRow

func (c *Controller) GetTableRow(rw http.ResponseWriter, r *http.Request)

GetTableRow handles the GET /chain/{chainID}/tables/{id}/{key}/{value} call. Use format=erc721 query param to generate JSON for ERC721 metadata. TODO(json-rpc): delete method when dropping support.

func (*Controller) GetTablesByController

func (c *Controller) GetTablesByController(rw http.ResponseWriter, r *http.Request)

GetTablesByController handles the GET /chain/{chainID}/tables/controller/{address} call. TODO(json-rpc): delete when dropping support.

func (*Controller) GetTablesByStructureHash

func (c *Controller) GetTablesByStructureHash(rw http.ResponseWriter, r *http.Request)

GetTablesByStructureHash handles the GET /chain/{id}/tables/structure/{hash} call. TODO(json-rpc): delete when dropping support.

func (*Controller) Version

func (c *Controller) Version(rw http.ResponseWriter, _ *http.Request)

Version returns git information of the running binary.

type Metadata

type Metadata struct {
	Image            interface{} `json:"image,omitempty"`
	ImageTransparent interface{} `json:"image_transparent,omitempty"`
	ImageData        interface{} `json:"image_data,omitempty"`
	ExternalURL      interface{} `json:"external_url,omitempty"`
	Description      interface{} `json:"description,omitempty"`
	Name             interface{} `json:"name,omitempty"`
	Attributes       []Attribute `json:"attributes,omitempty"`
	BackgroundColor  interface{} `json:"background_color,omitempty"`
	AnimationURL     interface{} `json:"animation_url,omitempty"`
	YoutubeURL       interface{} `json:"youtube_url,omitempty"`
}

Metadata represents erc721 metadata. Ref: https://docs.opensea.io/docs/metadata-standards

type MetadataConfig

type MetadataConfig struct {
	Image            string            `query:"image"`
	ImageTransparent string            `query:"image_transparent"`
	ImageData        string            `query:"image_data"`
	ExternalURL      string            `query:"external_url"`
	Description      string            `query:"description"`
	Name             string            `query:"name"`
	Attributes       []AttributeConfig `query:"attributes"`
	BackgroundColor  string            `query:"background_color"`
	AnimationURL     string            `query:"animation_url"`
	YoutubeURL       string            `query:"youtube_url"`
}

MetadataConfig defines columns should be mapped to erc721 metadata when using format=erc721 query param.

type SQLRunner

type SQLRunner interface {
	RunReadQuery(ctx context.Context, stmt string) (*tableland.TableData, error)
}

SQLRunner defines the run SQL interface of Tableland.

Directories

Path Synopsis
* Tableland Validator - OpenAPI 3.0 * * In Tableland, Validators are the execution unit/actors of the protocol.
* Tableland Validator - OpenAPI 3.0 * * In Tableland, Validators are the execution unit/actors of the protocol.

Jump to

Keyboard shortcuts

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