hrana

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT, MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncompleteAcknowledgement

func IncompleteAcknowledgement(cause error) error

func InvalidAcknowledgement

func InvalidAcknowledgement(cause error) error

Types

type Batch

type Batch struct {
	Steps            []BatchStep `json:"steps"`
	ReplicationIndex *uint64     `json:"replication_index,omitempty"`
}

func (*Batch) Add

func (b *Batch) Add(stmt Stmt, condition *BatchCondition)

type BatchCondition

type BatchCondition struct {
	Type  string           `json:"type"`
	Step  *int32           `json:"step,omitempty"`
	Cond  *BatchCondition  `json:"cond,omitempty"`
	Conds []BatchCondition `json:"conds,omitempty"`
}

type BatchResult

type BatchResult struct {
	StepResults      []*StmtResult `json:"step_results"`
	StepErrors       []*Error      `json:"step_errors"`
	ReplicationIndex *uint64       `json:"replication_index"`
}

func (*BatchResult) UnmarshalJSON

func (b *BatchResult) UnmarshalJSON(data []byte) error

type BatchStep

type BatchStep struct {
	Stmt      Stmt            `json:"stmt"`
	Condition *BatchCondition `json:"condition,omitempty"`
}

type Column

type Column struct {
	Name *string `json:"name"`
	Type *string `json:"decltype"`
}

type Error

type Error struct {
	Message string  `json:"message"`
	Code    *string `json:"code,omitempty"`
}

type InvalidAcknowledgementError

type InvalidAcknowledgementError struct {
	Cause    error
	BodyRead bool // HTTP headers arrived, but the response body was incomplete
}

InvalidAcknowledgementError means a received success response cannot confirm the requested operation. It is not a definite SQL rejection or a safe replay.

func (*InvalidAcknowledgementError) Error

func (*InvalidAcknowledgementError) Unwrap

func (e *InvalidAcknowledgementError) Unwrap() error

type NamedArg

type NamedArg struct {
	Name  string `json:"name"`
	Value Value  `json:"value"`
}

type PipelineRequest

type PipelineRequest struct {
	Baton    string          `json:"baton,omitempty"`
	Requests []StreamRequest `json:"requests"`
}

func (*PipelineRequest) Add

func (pr *PipelineRequest) Add(request StreamRequest)

type PipelineResponse

type PipelineResponse struct {
	Baton   string         `json:"baton,omitempty"`
	BaseUrl string         `json:"base_url,omitempty"`
	Results []StreamResult `json:"results"`
}

type Stmt

type Stmt struct {
	Sql              *string    `json:"sql,omitempty"`
	SqlId            *int32     `json:"sql_id,omitempty"`
	Args             []Value    `json:"args,omitempty"`
	NamedArgs        []NamedArg `json:"named_args,omitempty"`
	WantRows         bool       `json:"want_rows"`
	ReplicationIndex *uint64    `json:"replication_index,omitempty"`
}

func (*Stmt) AddArgs

func (s *Stmt) AddArgs(params shared.Params) error

func (*Stmt) AddNamedArgs

func (s *Stmt) AddNamedArgs(args map[string]any) error

func (*Stmt) AddPositionalArgs

func (s *Stmt) AddPositionalArgs(args []any) error

type StmtResult

type StmtResult struct {
	Cols             []Column  `json:"cols"`
	Rows             [][]Value `json:"rows"`
	AffectedRowCount int32     `json:"affected_row_count"`
	LastInsertRowId  *string   `json:"last_insert_rowid"`
	ReplicationIndex *uint64   `json:"replication_index"`
}

func (*StmtResult) GetLastInsertRowId

func (r *StmtResult) GetLastInsertRowId() int64

func (*StmtResult) UnmarshalJSON

func (r *StmtResult) UnmarshalJSON(data []byte) error

type StreamRequest

type StreamRequest struct {
	Type  string  `json:"type"`
	Stmt  *Stmt   `json:"stmt,omitempty"`
	Batch *Batch  `json:"batch,omitempty"`
	Sql   *string `json:"sql,omitempty"`
	SqlId *int32  `json:"sql_id,omitempty"`
}

func BatchStream

func BatchStream(sqls []string, params []shared.Params, wantRows bool, transactional bool) (*StreamRequest, error)

func CloseStoredSqlStream

func CloseStoredSqlStream(sqlId int32) StreamRequest

func CloseStream

func CloseStream() StreamRequest

func ExecuteStoredStream

func ExecuteStoredStream(sqlId int32, params shared.Params, wantRows bool) (*StreamRequest, error)

func ExecuteStream

func ExecuteStream(sql string, params *shared.Params, wantRows bool) (*StreamRequest, error)

func StoreSqlStream

func StoreSqlStream(sql string, sqlId int32) StreamRequest

type StreamResponse

type StreamResponse struct {
	Type   string          `json:"type"`
	Result json.RawMessage `json:"result,omitempty"`
	// RequestedBatch is set from the sent request, never from provider JSON.
	RequestedBatch *Batch `json:"-"`
}

func (*StreamResponse) BatchResult

func (r *StreamResponse) BatchResult() (*BatchResult, error)

func (*StreamResponse) ExecuteResult

func (r *StreamResponse) ExecuteResult() (*StmtResult, error)

type StreamResult

type StreamResult struct {
	Type     string          `json:"type"`
	Response *StreamResponse `json:"response,omitempty"`
	Error    *Error          `json:"error,omitempty"`
}

type Value

type Value struct {
	Type   string  `json:"type"`
	Value  any     `json:"value,omitempty"`
	Base64 *string `json:"base64,omitempty"`
}

func ToValue

func ToValue(v any) (Value, error)

func (Value) ToValue

func (v Value) ToValue(columnType *string) any

Jump to

Keyboard shortcuts

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