hanadb

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hanadb provides SAP HANA connection utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTableNotExist indicates that there is no such table.
	ErrTableNotExist = fmt.Errorf("collection/table does not exist")

	// ErrSchemaNotExist indicates that there is no such schema.
	ErrSchemaNotExist = fmt.Errorf("database/schema does not exist")

	// ErrSchemaAlreadyExist indicates that a schema already exists.
	ErrSchemaAlreadyExist = fmt.Errorf("database/schema already exists")

	// ErrCollectionAlreadyExist indicates that a collection already exists.
	ErrCollectionAlreadyExist = fmt.Errorf("collection/table already exists")

	// ErrInvalidCollectionName indicates that a collection didn't pass name checks.
	ErrInvalidCollectionName = fmt.Errorf("invalid FerretDB collection name")

	// ErrInvalidDatabaseName indicates that a database didn't pass name checks.
	ErrInvalidDatabaseName = fmt.Errorf("invalid FerretDB database name")
)

Errors are wrapped with lazyerrors.Error, so the caller needs to use errors.Is to check the error, for example, errors.Is(err, ErrSchemaNotExist).

Errors from HanaDB.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	*sql.DB
}

Pool represents SAP HANA concurrency-safe connection pool.

func NewPool

func NewPool(ctx context.Context, url string, logger *zap.Logger) (*Pool, error)

NewPool returns a new concurrency-safe connection pool.

func (*Pool) CreateCollection added in v1.1.0

func (hanaPool *Pool) CreateCollection(ctx context.Context, db, collection string) error

CreateCollection creates a new SAP HANA JSON Document Store collection.

It returns ErrAlreadyExist if collection already exist.

func (*Pool) CreateSchema added in v1.1.0

func (hanaPool *Pool) CreateSchema(ctx context.Context, db string) error

CreateSchema creates a schema in SAP HANA JSON Document Store.

func (*Pool) DropCollection added in v1.1.0

func (hanaPool *Pool) DropCollection(ctx context.Context, db, collection string) error

DropCollection drops collection

It returns ErrTableNotExist is collection does not exist.

func (*Pool) DropSchema added in v1.1.0

func (hanaPool *Pool) DropSchema(ctx context.Context, db string) error

DropSchema drops database

It returns ErrSchemaNotExist if schema does not exist.

Jump to

Keyboard shortcuts

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