sql

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

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

Result implements sql.Result and sql.RowsIterator. Depending on the statement type it represents a stream of rows or an update count. It is not concurrency-safe except the Close and Iterator method.

func (*Result) Close

func (r *Result) Close() error

Close notifies the member to release resources for the corresponding query for results that represents a stream of rows. It can be safely called more than once, and it is concurrency-safe. If result represents an update count, it has no effect.

func (*Result) Err

func (r *Result) Err() error

Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.

func (*Result) HasNext

func (r *Result) HasNext() bool

HasNext prepares the next result row for reading via Next method. It returns true on success, or false if there is no next result row or an error happened while preparing it.

func (*Result) IsRowSet

func (r *Result) IsRowSet() bool

IsRowSet returns whether this result has rows to iterate using the HasNext method.

func (*Result) Iterator

func (r *Result) Iterator() (sql.RowsIterator, error)

func (*Result) Next

func (r *Result) Next() (sql.Row, error)

Next returns the currentRow. Every call to Next, even the first one, must be preceded by a call to HasNext.

func (*Result) RowMetadata

func (r *Result) RowMetadata() (sql.RowMetadata, error)

RowMetadata returns metadata information about rows. An error is returned if result represents an update count.

func (*Result) UpdateCount

func (r *Result) UpdateCount() int64

UpdateCount returns the number of rows updated by the statement or -1 if this result is a row set. In case the result doesn't contain rows but the update count isn't applicable or known, 0 is returned.

type Row

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

Row represents an SQL result row.

func (Row) Get

func (r Row) Get(index int) (interface{}, error)

Get returns the value of the column by index. If index is out of range, an error is returned.

func (Row) GetByColumnName

func (r Row) GetByColumnName(colName string) (interface{}, error)

GetByColumnName returns the value of the column by name. If columns does not exist, an error is returned.

func (Row) Metadata

func (r Row) Metadata() sql.RowMetadata

Metadata returns the metadata information about the row.

type Service

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

func (Service) Execute

func (s Service) Execute(ctx context.Context, query string, params ...interface{}) (sql.Result, error)

Execute is a convenient method to execute a distributed query with the given parameter values. You may define parameter placeholders in the query with the "?" character. For every placeholder, a value must be provided.

func (Service) ExecuteStatement

func (s Service) ExecuteStatement(ctx context.Context, stmt sql.Statement) (sql.Result, error)

ExecuteStatement executes the given SQL statement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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