Documentation ¶
Index ¶
- Variables
- func ConvertSchemaToEngine(old *transactions.Schema) (*engineTypes.Schema, error)
- type AccountStore
- type DatabaseUseCaseOpt
- type DatasetModule
- func (u *DatasetModule) Call(ctx context.Context, dbid string, action string, args []any, ...) ([]map[string]any, error)
- func (u *DatasetModule) Deploy(ctx context.Context, schema *engineTypes.Schema, tx *transactions.Transaction) (*ExecutionResponse, error)
- func (u *DatasetModule) Drop(ctx context.Context, dbid string, tx *transactions.Transaction) (*ExecutionResponse, error)
- func (u *DatasetModule) Execute(ctx context.Context, dbid string, action string, args [][]any, ...) (*ExecutionResponse, error)
- func (u *DatasetModule) GetSchema(ctx context.Context, dbid string) (*engineTypes.Schema, error)
- func (u *DatasetModule) ListOwnedDatabases(ctx context.Context, owner []byte) ([]*coreTypes.DatasetIdentifier, error)
- func (d *DatasetModule) PriceDeploy(ctx context.Context, schema *engineTypes.Schema) (price *big.Int, err error)
- func (d *DatasetModule) PriceDrop(ctx context.Context, dbid string) (price *big.Int, err error)
- func (d *DatasetModule) PriceExecute(ctx context.Context, dbid string, action string, args [][]any) (price *big.Int, err error)
- func (u *DatasetModule) Query(ctx context.Context, dbid string, query string) ([]map[string]any, error)
- type Engine
- type ExecutionResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInsufficientFee = errors.New("insufficient fee") ErrAuthenticationFailed = errors.New("authentication failed") )
Functions ¶
func ConvertSchemaToEngine ¶
func ConvertSchemaToEngine(old *transactions.Schema) (*engineTypes.Schema, error)
Types ¶
type AccountStore ¶
type DatabaseUseCaseOpt ¶
type DatabaseUseCaseOpt func(*DatasetModule)
func WithFeeMultiplier ¶
func WithFeeMultiplier(multiplier int64) DatabaseUseCaseOpt
WithFeeMultiplier sets the fee multiplier pricing
type DatasetModule ¶
type DatasetModule struct {
// contains filtered or unexported fields
}
func NewDatasetModule ¶
func NewDatasetModule(engine Engine, accountStore AccountStore, opts ...DatabaseUseCaseOpt) *DatasetModule
func (*DatasetModule) Call ¶
func (u *DatasetModule) Call(ctx context.Context, dbid string, action string, args []any, msg *transactions.CallMessage) ([]map[string]any, error)
Call executes a call action on a database. It is a read-only action. It returns the result of the call. If a message caller is specified, then it will check the signature of the message and use the caller as the caller of the action.
func (*DatasetModule) Deploy ¶
func (u *DatasetModule) Deploy(ctx context.Context, schema *engineTypes.Schema, tx *transactions.Transaction) (*ExecutionResponse, error)
Deploy deploys a database.
func (*DatasetModule) Drop ¶
func (u *DatasetModule) Drop(ctx context.Context, dbid string, tx *transactions.Transaction) (*ExecutionResponse, error)
Drop drops a database.
func (*DatasetModule) Execute ¶
func (u *DatasetModule) Execute(ctx context.Context, dbid string, action string, args [][]any, tx *transactions.Transaction) (*ExecutionResponse, error)
Execute executes an action against a database.
func (*DatasetModule) GetSchema ¶
func (u *DatasetModule) GetSchema(ctx context.Context, dbid string) (*engineTypes.Schema, error)
GetSchema returns the schema of a database.
func (*DatasetModule) ListOwnedDatabases ¶
func (u *DatasetModule) ListOwnedDatabases(ctx context.Context, owner []byte) ([]*coreTypes.DatasetIdentifier, error)
ListOwnedDatabase returns a list of databases owned by a public key.
func (*DatasetModule) PriceDeploy ¶
func (d *DatasetModule) PriceDeploy(ctx context.Context, schema *engineTypes.Schema) (price *big.Int, err error)
PriceDeploy returns the price of deploying a schema.
type Engine ¶
type Engine interface { CreateDataset(ctx context.Context, schema *types.Schema, caller []byte) (err error) DeleteDataset(ctx context.Context, dbid string, caller []byte) error Execute(ctx context.Context, data *types.ExecutionData) (*sql.ResultSet, error) GetSchema(ctx context.Context, dbid string) (*types.Schema, error) ListDatasets(ctx context.Context, caller []byte) ([]*coreTypes.DatasetIdentifier, error) Query(ctx context.Context, dbid string, query string) (*sql.ResultSet, error) }
type ExecutionResponse ¶
type ExecutionResponse struct { // Fee is the amount of tokens spent on the execution Fee *big.Int GasUsed int64 // ? }
ExecutionResponse is the response from any interaction that modifies state.
Click to show internal directories.
Click to hide internal directories.