ptable

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 6 Imported by: 3

README

propertydb

Property DB 是一个非常简单的数据库,基于 properties 文件

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() application.Module

Module 导出本模块

Types

type Column

type Column interface {
	Owner() Table
	TableName() string
	ColumnName() string
}

Column 负责某个字段(列)的访问

type ColumnBool

type ColumnBool interface {
	Column
	Get(row Row) bool
	Set(row Row, value bool)
}

ColumnBool ...

type ColumnFloat32

type ColumnFloat32 interface {
	Column
	Get(row Row) float32
	Set(row Row, value float32)
}

ColumnFloat32 ...

type ColumnFloat64

type ColumnFloat64 interface {
	Column
	Get(row Row) float64
	Set(row Row, value float64)
}

ColumnFloat64 ...

type ColumnInt

type ColumnInt interface {
	Column
	Get(row Row) int
	Set(row Row, value int)
}

ColumnInt ...

type ColumnInt16

type ColumnInt16 interface {
	Column
	Get(row Row) int16
	Set(row Row, value int16)
}

ColumnInt16 ...

type ColumnInt32

type ColumnInt32 interface {
	Column
	Get(row Row) int32
	Set(row Row, value int32)
}

ColumnInt32 ...

type ColumnInt64

type ColumnInt64 interface {
	Column
	Get(row Row) int64
	Set(row Row, value int64)
}

ColumnInt64 ...

type ColumnInt8

type ColumnInt8 interface {
	Column
	Get(row Row) int8
	Set(row Row, value int8)
}

ColumnInt8 ...

type ColumnString

type ColumnString interface {
	Column
	Get(row Row) string
	Set(row Row, value string)
}

ColumnString ...

type ColumnTime

type ColumnTime interface {
	Column
	Get(row Row) time.Time
	Set(row Row, value time.Time)
}

ColumnTime ...

type ColumnUint

type ColumnUint interface {
	Column
	Get(row Row) uint
	Set(row Row, value uint)
}

ColumnUint ...

type ColumnUint16

type ColumnUint16 interface {
	Column
	Get(row Row) uint16
	Set(row Row, value uint16)
}

ColumnUint16 ...

type ColumnUint32

type ColumnUint32 interface {
	Column
	Get(row Row) uint32
	Set(row Row, value uint32)
}

ColumnUint32 ...

type ColumnUint64

type ColumnUint64 interface {
	Column
	Get(row Row) uint64
	Set(row Row, value uint64)
}

ColumnUint64 ...

type ColumnUint8

type ColumnUint8 interface {
	Column
	Get(row Row) uint8
	Set(row Row, value uint8)
}

ColumnUint8 ...

type ColumnX

type ColumnX interface {
	Column
}

ColumnX ...

type DataDir

type DataDir interface {
	Path() fs.Path
	OpenDatabase(name string, init bool) (Database, error)
}

DataDir 指向一个文件夹,是 Database 的容器

type DataDirFactory

type DataDirFactory interface {
	// Init(dir fs.Path) (DataDir, error)
	Open(dir fs.Path, init bool) (DataDir, error)
}

DataDirFactory 是 DataDir 的生产者

type DataSource added in v0.0.3

type DataSource interface {
	GetSession() Session
	GetDatabase() Database
}

DataSource 代表指向DB的数据源

type Database

type Database interface {
	Name() string
	Path() fs.Path
	Owner() DataDir
	OpenTable(p *TableOpen) (Table, error)
	OpenSession() (Session, error)
}

Database 指向一个文件夹,是 Table 的容器

type DatabaseFactory

type DatabaseFactory interface {
	Open(name string, dir fs.Path, owner DataDir, init bool) (Database, error)
}

DatabaseFactory 是 Database 的生产者

type Repository added in v0.0.3

type Repository interface {
	Init(ds DataSource) error
}

Repository 代表某个表的存储库

type Row

type Row interface {
	Owner() Table
	Key() string
	Delete() error
	SetValue(field string, value string) error
	GetValue(field string) (string, error)
	Exists() bool
}

Row 指向具体的一行记录

type Session

type Session interface {
	io.Closer
	BeginTransaction() Transaction
	DB() Database
	GetProperties(table Table) collection.Properties
	ListIDs(table Table) []string
	GetRow(table Table, key string) Row
	GetRowRequired(table Table, key string) (Row, error)
}

Session 会话对象

type SessionFactory

type SessionFactory interface {
	OpenSession(db Database) (Session, error)
}

SessionFactory 会话工厂

type SessionManager

type SessionManager interface {
	GetSession(db Database, create bool) (Session, error)
}

SessionManager 会话管理器

type Table

type Table interface {
	Owner() Database
	Path() fs.Path
	Name() string
	PrimaryKey() string

	GetColumnString(name string) ColumnString
	GetColumnBool(name string) ColumnBool
	GetColumnTime(name string) ColumnTime

	GetColumnFloat32(name string) ColumnFloat32
	GetColumnFloat64(name string) ColumnFloat64

	GetColumnInt(name string) ColumnInt
	GetColumnInt8(name string) ColumnInt8
	GetColumnInt16(name string) ColumnInt16
	GetColumnInt32(name string) ColumnInt32
	GetColumnInt64(name string) ColumnInt64

	GetColumnUint(name string) ColumnUint
	GetColumnUint8(name string) ColumnUint8
	GetColumnUint16(name string) ColumnUint16
	GetColumnUint32(name string) ColumnUint32
	GetColumnUint64(name string) ColumnUint64
}

Table 指向一个文件,是 Entity 的容器

type TableFactory

type TableFactory interface {
	Open(p *TableOpen) (Table, error)
}

TableFactory 是 Table 的生产者

type TableOpen

type TableOpen struct {
	TableName  string
	PrimaryKey string // default is 'id'
	File       fs.Path
	OwnerDB    Database
	DoInit     bool
}

TableOpen 是打开 Table 的参数

func (*TableOpen) Clone

func (inst *TableOpen) Clone() *TableOpen

type Transaction

type Transaction interface {
	io.Closer
	Commit()
	Rollback()
}

Transaction 事务对象

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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