sqldb

package module
v0.0.0-...-a418af8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

sqldb: wasmcloud database capability contract

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SqlDbContractId

func SqlDbContractId() string

SqlDbContractId returns the capability contract id for this interface

func SqlDbHandler

func SqlDbHandler(actor_ SqlDb) actor.Handler

SqlDbHandler is called by an actor during `main` to generate a dispatch handler The output of this call should be passed into `actor.RegisterHandlers`

Types

type Column

type Column struct {
	// column ordinal
	Ordinal uint32
	// Column name in the result
	Name string
	// column data type as reported by the database
	DbType string
}

Metadata about a Column in the result set

func CDecodeColumn

func CDecodeColumn(d *cbor.Decoder) (Column, error)

CDecodeColumn deserializes a Column using cbor

func MDecodeColumn

func MDecodeColumn(d *msgpack.Decoder) (Column, error)

MDecodeColumn deserializes a Column using msgpack

func (*Column) CEncode

func (o *Column) CEncode(encoder cbor.Writer) error

CEncode serializes a Column using cbor

func (*Column) MEncode

func (o *Column) MEncode(encoder msgpack.Writer) error

MEncode serializes a Column using msgpack

type Columns

type Columns []Column

List of columns in the result set returned by a Query operation

func CDecodeColumns

func CDecodeColumns(d *cbor.Decoder) (Columns, error)

CDecodeColumns deserializes a Columns using cbor

func MDecodeColumns

func MDecodeColumns(d *msgpack.Decoder) (Columns, error)

MDecodeColumns deserializes a Columns using msgpack

func (*Columns) CEncode

func (o *Columns) CEncode(encoder cbor.Writer) error

CEncode serializes a Columns using cbor

func (*Columns) MEncode

func (o *Columns) MEncode(encoder msgpack.Writer) error

MEncode serializes a Columns using msgpack

type ExecuteResult

type ExecuteResult struct {
	// the number of rows affected by the query
	RowsAffected uint64
	// optional error information.
	// If error is included in the QueryResult, other values should be ignored.
	Error *SqlDbError
}

Result of an Execute operation

func CDecodeExecuteResult

func CDecodeExecuteResult(d *cbor.Decoder) (ExecuteResult, error)

CDecodeExecuteResult deserializes a ExecuteResult using cbor

func MDecodeExecuteResult

func MDecodeExecuteResult(d *msgpack.Decoder) (ExecuteResult, error)

MDecodeExecuteResult deserializes a ExecuteResult using msgpack

func (*ExecuteResult) CEncode

func (o *ExecuteResult) CEncode(encoder cbor.Writer) error

CEncode serializes a ExecuteResult using cbor

func (*ExecuteResult) MEncode

func (o *ExecuteResult) MEncode(encoder msgpack.Writer) error

MEncode serializes a ExecuteResult using msgpack

type Parameters

type Parameters [][]byte

An optional list of arguments to be used in the SQL statement. When a statement uses question marks '?' for placeholders, the capability provider will replace the specified arguments during execution. The command must have exactly as many placeholders as arguments, or the request will fail. The members are CBOR encoded.

func CDecodeParameters

func CDecodeParameters(d *cbor.Decoder) (Parameters, error)

CDecodeParameters deserializes a Parameters using cbor

func MDecodeParameters

func MDecodeParameters(d *msgpack.Decoder) (Parameters, error)

MDecodeParameters deserializes a Parameters using msgpack

func (*Parameters) CEncode

func (o *Parameters) CEncode(encoder cbor.Writer) error

CEncode serializes a Parameters using cbor

func (*Parameters) MEncode

func (o *Parameters) MEncode(encoder msgpack.Writer) error

MEncode serializes a Parameters using msgpack

type PingResult

type PingResult struct {
	// Optional error information.
	Error *SqlDbError
}

func CDecodePingResult

func CDecodePingResult(d *cbor.Decoder) (PingResult, error)

CDecodePingResult deserializes a PingResult using cbor

func MDecodePingResult

func MDecodePingResult(d *msgpack.Decoder) (PingResult, error)

MDecodePingResult deserializes a PingResult using msgpack

func (*PingResult) CEncode

func (o *PingResult) CEncode(encoder cbor.Writer) error

CEncode serializes a PingResult using cbor

func (*PingResult) MEncode

func (o *PingResult) MEncode(encoder msgpack.Writer) error

MEncode serializes a PingResult using msgpack

type QueryResult

type QueryResult struct {
	// number of rows returned
	NumRows uint64
	// description of columns returned
	Columns Columns
	// result rows, encoded in CBOR as
	// an array (rows) of arrays (fields per row)
	Rows []byte
	// optional error information.
	// If error is included in the QueryResult, other values should be ignored.
	Error *SqlDbError
}

Result of a query

func CDecodeQueryResult

func CDecodeQueryResult(d *cbor.Decoder) (QueryResult, error)

CDecodeQueryResult deserializes a QueryResult using cbor

func MDecodeQueryResult

func MDecodeQueryResult(d *msgpack.Decoder) (QueryResult, error)

MDecodeQueryResult deserializes a QueryResult using msgpack

func (*QueryResult) CEncode

func (o *QueryResult) CEncode(encoder cbor.Writer) error

CEncode serializes a QueryResult using cbor

func (*QueryResult) MEncode

func (o *QueryResult) MEncode(encoder msgpack.Writer) error

MEncode serializes a QueryResult using msgpack

type SqlDb

type SqlDb interface {
	// Execute an sql statement
	Execute(ctx *actor.Context, arg Statement) (*ExecuteResult, error)
	// Perform select query on database, returning all result rows
	Query(ctx *actor.Context, arg Statement) (*QueryResult, error)
}

SqlDb - SQL Database connections To use this capability, the actor must be linked with the capability contract "wasmcloud:sqldb"

type SqlDbError

type SqlDbError struct {
	// Type of error.
	// The list of enum variants for this field may be expanded in the future
	// to provide finer-granularity failure information
	Code string
	// error message
	Message string
}

Detailed error information from the previous operation

func CDecodeSqlDbError

func CDecodeSqlDbError(d *cbor.Decoder) (SqlDbError, error)

CDecodeSqlDbError deserializes a SqlDbError using cbor

func MDecodeSqlDbError

func MDecodeSqlDbError(d *msgpack.Decoder) (SqlDbError, error)

MDecodeSqlDbError deserializes a SqlDbError using msgpack

func (*SqlDbError) CEncode

func (o *SqlDbError) CEncode(encoder cbor.Writer) error

CEncode serializes a SqlDbError using cbor

func (*SqlDbError) MEncode

func (o *SqlDbError) MEncode(encoder msgpack.Writer) error

MEncode serializes a SqlDbError using msgpack

type SqlDbReceiver

type SqlDbReceiver struct{}

SqlDbReceiver receives messages defined in the SqlDb service interface SqlDb - SQL Database connections To use this capability, the actor must be linked with the capability contract "wasmcloud:sqldb"

func (*SqlDbReceiver) Dispatch

func (r *SqlDbReceiver) Dispatch(ctx *actor.Context, svc interface{}, message *actor.Message) (*actor.Message, error)

type SqlDbSender

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

SqlDbSender sends messages to a SqlDb service SqlDb - SQL Database connections To use this capability, the actor must be linked with the capability contract "wasmcloud:sqldb"

func NewProviderSqlDb

func NewProviderSqlDb() *SqlDbSender

NewProvider constructs a client for sending to a SqlDb provider implementing the 'wasmcloud:sqldb' capability contract, with the "default" link

func NewProviderSqlDbLink(linkName string) *SqlDbSender

NewProviderSqlDbLink constructs a client for sending to a SqlDb provider implementing the 'wasmcloud:sqldb' capability contract, with the specified link name

func (*SqlDbSender) Execute

func (s *SqlDbSender) Execute(ctx *actor.Context, arg Statement) (*ExecuteResult, error)

Execute an sql statement

func (*SqlDbSender) Query

func (s *SqlDbSender) Query(ctx *actor.Context, arg Statement) (*QueryResult, error)

Perform select query on database, returning all result rows

type Statement

type Statement struct {
	// Optional database in which the statement must be executed.
	// The value in this field is case-sensitive.
	Database   string
	Parameters *Parameters
	// A sql query or statement that is a non-empty string containing
	// in the syntax of the back-end database.
	Sql string
}

func CDecodeStatement

func CDecodeStatement(d *cbor.Decoder) (Statement, error)

CDecodeStatement deserializes a Statement using cbor

func MDecodeStatement

func MDecodeStatement(d *msgpack.Decoder) (Statement, error)

MDecodeStatement deserializes a Statement using msgpack

func (*Statement) CEncode

func (o *Statement) CEncode(encoder cbor.Writer) error

CEncode serializes a Statement using cbor

func (*Statement) MEncode

func (o *Statement) MEncode(encoder msgpack.Writer) error

MEncode serializes a Statement using msgpack

Jump to

Keyboard shortcuts

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