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 ¶
CDecodeColumn deserializes a Column using cbor
func MDecodeColumn ¶
MDecodeColumn deserializes a Column using msgpack
type Columns ¶
type Columns []Column
List of columns in the result set returned by a Query operation
func CDecodeColumns ¶
CDecodeColumns deserializes a Columns using cbor
func MDecodeColumns ¶
MDecodeColumns deserializes 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
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
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
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
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
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 ¶
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 ¶
CDecodeStatement deserializes a Statement using cbor
func MDecodeStatement ¶
MDecodeStatement deserializes a Statement using msgpack