sql

package
v1.8.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQLRows

func ParseSQLRows(rows *sql.Rows, schema interface{}) ([]interface{}, error)

ParseSQLRows will parse the row

func TestStorePutGet

func TestStorePutGet(sqlStore Store, t *testing.T)

TestStorePutGet define the common test cases for put and get

func TestStoreTransaction

func TestStoreTransaction(sqlStore Store, t *testing.T)

TestStoreTransaction define the common test cases for transaction

Types

type ActionHistory

type ActionHistory struct {
	NodeAddress string
	UserAddress string
	ActionHash  string
}

ActionHistory define the schema for action history

type CQLITE3 added in v1.1.4

type CQLITE3 struct {
	// SQLite3File is the sqlite3 db file
	SQLite3File string `yaml:"sqlite3File"`
}

CQLITE3 is the local sqlite3 config

type RDS added in v1.1.4

type RDS struct {
	// AwsRDSEndpoint is the endpoint of aws rds
	AwsRDSEndpoint string `yaml:"awsRDSEndpoint"`
	// AwsRDSPort is the port of aws rds
	AwsRDSPort uint64 `yaml:"awsRDSPort"`
	// AwsRDSUser is the user to access aws rds
	AwsRDSUser string `yaml:"awsRDSUser"`
	// AwsPass is the pass to access aws rds
	AwsPass string `yaml:"awsPass"`
	// AwsDBName is the db name of aws rds
	AwsDBName string `yaml:"awsDBName"`
}

RDS is the cloud rds config

type Store

type Store interface {
	lifecycle.StartStopper

	// Get DB instance
	GetDB() *sql.DB

	// Transact wrap the transaction
	Transact(txFunc func(*sql.Tx) error) (err error)
}

Store is the interface of KV store.

func NewAwsRDS

func NewAwsRDS(cfg RDS) Store

NewAwsRDS instantiates an aws rds

func NewSQLite3

func NewSQLite3(cfg CQLITE3) Store

NewSQLite3 instantiates an sqlite3

Jump to

Keyboard shortcuts

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