Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) CheckHealth(ctx context.Context) (bool, error)
- func (c *Client) Create(ctx context.Context, schema string, opts ...CreateOption) (TableID, string, error)
- func (c *Client) GetTable(ctx context.Context, tableID TableID) (*apiv1.Table, error)
- func (c *Client) Hash(statement string) (string, error)
- func (c *Client) Read(ctx context.Context, query string, target interface{}, opts ...ReadOption) error
- func (c *Client) Receipt(ctx context.Context, txnHash string, options ...ReceiptOption) (*apiv1.TransactionReceipt, bool, error)
- func (c *Client) Validate(statement string) (TableID, error)
- func (c *Client) Version(ctx context.Context) (*apiv1.VersionInfo, error)
- func (c *Client) Write(ctx context.Context, query string) (string, error)
- type CreateOption
- type NewClientOption
- type Output
- type ReadOption
- type ReceiptOption
- type TableID
Constants ¶
This section is empty.
Variables ¶
var ErrTableNotFound = errors.New("table not found")
ErrTableNotFound is returned if the provided table ID isn't found in the network.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Tableland client.
func NewClient ¶
func NewClient(ctx context.Context, wallet *wallet.Wallet, opts ...NewClientOption) (*Client, error)
NewClient creates a new Client.
func (*Client) CheckHealth ¶
CheckHealth returns true if the targeted validator endpoint is considered healthy, and false otherwise.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, schema string, opts ...CreateOption) (TableID, string, error)
Create creates a new table on the Tableland.
func (*Client) GetTable ¶
GetTable returns the table information given its ID. If the table ID doesn't exist, it returns ErrTableNotFound.
func (*Client) Read ¶
func (c *Client) Read(ctx context.Context, query string, target interface{}, opts ...ReadOption) error
Read runs a read query with the provided opts and unmarshals the results into target.
func (*Client) Receipt ¶
func (c *Client) Receipt( ctx context.Context, txnHash string, options ...ReceiptOption, ) (*apiv1.TransactionReceipt, bool, error)
Receipt gets a transaction receipt.
type CreateOption ¶
type CreateOption func(*createConfig)
CreateOption controls the behavior of Create.
func WithPrefix ¶
func WithPrefix(prefix string) CreateOption
WithPrefix allows you to specify an optional table name prefix where the final table name will be <prefix>_<chain-id>_<tableid>.
func WithReceiptTimeout ¶
func WithReceiptTimeout(timeout time.Duration) CreateOption
WithReceiptTimeout specifies how long to wait for the Tableland receipt that contains the table id.
type NewClientOption ¶
type NewClientOption func(*config)
NewClientOption controls the behavior of NewClient.
func NewClientAlchemyAPIKey ¶
func NewClientAlchemyAPIKey(key string) NewClientOption
NewClientAlchemyAPIKey specifies an Alchemy API to use when creating an EVM backend.
func NewClientChain ¶
func NewClientChain(chain client.Chain) NewClientOption
NewClientChain specifies chaininfo.
func NewClientContractBackend ¶
func NewClientContractBackend(backend bind.ContractBackend) NewClientOption
NewClientContractBackend specifies a custom EVM backend to use.
func NewClientInfuraAPIKey ¶
func NewClientInfuraAPIKey(key string) NewClientOption
NewClientInfuraAPIKey specifies an Infura API to use when creating an EVM backend.
func NewClientLocal ¶
func NewClientLocal() NewClientOption
NewClientLocal specifies that a local EVM backend should be used.
type Output ¶
type Output string
Output is used to control the output format of a Read using the ReadOutput option.
type ReadOption ¶
type ReadOption func(*readQueryParameters)
ReadOption controls the behavior of Read.
func ReadExtract ¶
func ReadExtract() ReadOption
ReadExtract specifies whether or not to extract the JSON object from the single property of the surrounding JSON object. Default is false.
func ReadFormat ¶
func ReadFormat(output Output) ReadOption
ReadFormat sets the output format. Default is Objects.
func ReadUnwrap ¶
func ReadUnwrap() ReadOption
ReadUnwrap specifies whether or not to unwrap the returned JSON objects from their surrounding array. Default is false.
type ReceiptOption ¶
type ReceiptOption func(*receiptConfig)
ReceiptOption controls the behavior of calls to Receipt.
func WaitFor ¶
func WaitFor(timeout time.Duration) ReceiptOption
WaitFor causes calls to Receipt to wait for the specified duration.