sqlite

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT, Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeyStore

func NewKeyStore(conn *Conn) storage.KeyStore

func NewRouterStore

func NewRouterStore(conn *Conn) storage.StrategyStore

Types

type Conn

type Conn struct {
	DB *gorm.DB
}

for sqlite use a single file socket

func NewSQLiteConn

func NewSQLiteConn(cfg *config.DBConfig) (*Conn, error)

type Group

type Group struct {
	GroupId   uint   `gorm:"primaryKey;type:int;column:id;not null"`
	Name      string `gorm:"unique;type:varchar(32);column:name;not null"`
	BindIds   string `gorm:"type:text;column:bind_ids;not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime `gorm:"index"`
}

Group multi KeyBind NOTE: routeType 3

type GroupAuth

type GroupAuth struct {
	// uuid
	Token   string `gorm:"primaryKey;type:varchar(36);column:token;not null"`
	GroupId uint   `gorm:"index;type:int;column:id;not null"`
	//Public    []byte //pubkey for verify data source
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime `gorm:"index"`
}

GroupAuth relation with Group and generate a token for external invocation NOTE: routeType 1

type Key

type Key struct {
	core.KeyInfo
	PublicKey []byte
	Address   core.Address
}

type KeyBind

type KeyBind struct {
	BindId  uint   `gorm:"primaryKey;type:int;column:id;not null"`
	Name    string `gorm:"unique;type:varchar(32);column:name;not null"`
	Address string `gorm:"index;type:varchar(255);column:address;not null"`
	// source from MsgTypeTemplate or temporary create
	MetaTypes core.MsgEnum `gorm:"type:int;column:meta_types;not null"`
	// source from MethodTemplate
	MethodNames string `gorm:"type:text;column:methods;not null"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   sql.NullTime `gorm:"index"`
}

KeyBind bind wallet usage strategy allow designated rule to pass NOTE: routeType 2

type MethodTemplate

type MethodTemplate struct {
	MTId uint   `gorm:"primaryKey;type:int;column:id;not null"`
	Name string `gorm:"unique;type:varchar(32);column:name;not null"`
	// method name join with ','
	Methods   string `gorm:"type:text;column:methods;not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime `gorm:"index"`
}

MethodTemplate to quickly create a private key usage strategy msg actor and methodNum agg to method name NOTE: routeType 4

type MsgTypeTemplate

type MsgTypeTemplate struct {
	MTTId     uint         `gorm:"primaryKey;type:int;column:id;not null"`
	Name      string       `gorm:"unique;type:varchar(36);column:name;not null"`
	MetaTypes core.MsgEnum `gorm:"type:int;column:meta_types;not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt sql.NullTime `gorm:"index"`
}

MsgTypeTemplate to quickly create a private key usage strategy NOTE: routeType 5

type SqlKeyInfo

type SqlKeyInfo core.KeyInfo

func (*SqlKeyInfo) IsValid

func (mki *SqlKeyInfo) IsValid() bool

func (*SqlKeyInfo) Scan

func (mki *SqlKeyInfo) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (SqlKeyInfo) Value

func (mki SqlKeyInfo) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type SqlScannerValuer

type SqlScannerValuer interface {
	sql.Scanner
	driver.Valuer
}

type TableName

type TableName = string
const (
	TBWallet          TableName = "wallets"
	TBGroupAuth       TableName = "groupAuth"
	TBKeyBind         TableName = "keyBind"
	TBGroup           TableName = "group"
	TBMethodTemplate  TableName = "methodTmp"
	TBMsgTypeTemplate TableName = "typeTmp"
)

type Wallet

type Wallet struct {
	gorm.Model
	Address string            `gorm:"type:varchar(255);uniqueIndex"`
	KeyInfo *SqlKeyInfo       `gorm:"type:blob;column:private_key;not null"`
	Meta    *SqlScannerValuer `gorm:"type:blob;column:meta;default:null"`
}

func (*Wallet) TableName

func (w *Wallet) TableName() string

Jump to

Keyboard shortcuts

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