session

package
v0.0.0-...-959c02d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMultipleStatementsNotSupported = errors.New("multiple statements not supported")
	ErrFieldCountNotMatch             = errors.New("field count not match")
)

Functions

This section is empty.

Types

type ResultSet

type ResultSet interface {
	Columns() []string
	// Valid reports whether the current result set valid.
	Valid() bool
	// Next advances the current result set to the next row of query result.
	Next(ctx context.Context) error
	// Row returns the current row of query result.
	Row() datum.Row
	// Close closes the current result set, which will release all query intermediate resources..
	Close() error
}

ResultSet represents the result of a query.

type Session

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

Session represents the session to interact with zGraph database instance. Typically, the number of session will be same as the concurrent thread count of the application. All execution intermediate variables should be placed in the Context.

func New

func New(store kv.Storage, catalog *catalog.Catalog) *Session

New returns a new session instance.

func (*Session) Close

func (s *Session) Close()

Close terminates the current session.

func (*Session) Execute

func (s *Session) Execute(ctx context.Context, query string) (ResultSet, error)

Execute executes a query and reports whether the query executed successfully or not. A result set will be non-empty if execute successfully.

func (*Session) ID

func (s *Session) ID() int64

ID returns a integer identifier of the current session.

func (*Session) OnClosed

func (s *Session) OnClosed(cb func(session *Session))

OnClosed sets the closed callback which will invoke after session closed.

func (*Session) StmtContext

func (s *Session) StmtContext() *stmtctx.Context

StmtContext returns the statement context object.

Jump to

Keyboard shortcuts

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