data

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProject

func CreateProject(prjname string) (err error)

创建项目

func ProjectFullPath

func ProjectFullPath(prjname string) string

项目的完整路径

func SetDataMan

func SetDataMan(man IDataMan)

设置数据管理器, 只能设置一次, 并且必须在使用任何数据之前设置

Types

type Category

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

func (*Category) DataID

func (this *Category) DataID() string

func (*Category) DataName

func (this *Category) DataName() string

func (*Category) IsUnderWell

func (this *Category) IsUnderWell() bool

井下的分类, 子节点应该是数据 不在井下的分类, 子节点应该是井, 再下一级才是数据

type DB

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

func OpenDB

func OpenDB(driverName, dataSourceName string) (*DB, error)

打开数据库

func (*DB) BatchExec

func (db *DB) BatchExec(multiSql string, autoTransaction, breakOnError bool) error

批量执行多条SQL, 各SQL之间以分号';'分隔

func (*DB) BatchExec1

func (db *DB) BatchExec1(multiSql []string, autoTransaction, breakOnError bool) error

func (*DB) Close

func (db *DB) Close()

func (*DB) Exec

func (db *DB) Exec(s string) (sql.Result, error)

func (*DB) String

func (db *DB) String() string

type DefaultDataMan

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

默认的数据管理器, 可扩展

func (*DefaultDataMan) Children

func (man *DefaultDataMan) Children(d IData) []IData

func (*DefaultDataMan) ProjectNames

func (man *DefaultDataMan) ProjectNames() (list []string)

func (*DefaultDataMan) Projects

func (man *DefaultDataMan) Projects() (list []*Project)

列出所有项目

func (*DefaultDataMan) RefreshProjects

func (man *DefaultDataMan) RefreshProjects() error

刷新项目列表

func (*DefaultDataMan) Roots

func (man *DefaultDataMan) Roots() (ret []IData)

type FBlock32

type FBlock32 interface {
	Data() []float32
	RowCount() int
	ColCount() int
	Get(row, col int) float32
	Set(row, col int, a float32)
}

type ICategoryID

type ICategoryID interface {
	// 数据类型
	CategoryID() string
}

type IData

type IData interface {

	// 数据对象的标识
	// 在同一个父对象下, 对象标识应该唯一
	DataID() string

	// 显示的名称, 可随语种/用户习惯变化, 例如井在某些应用中应显示为"井筒"
	// 此名称的变化不应影响到软件的实际功能.
	DataName() string
}

抽象的数据接口 此接口用来表示较大的数据, 不适合表示"曲线上的点"之类的琐碎数据

type IDataMan

type IDataMan interface {
	// 数据的根节点
	// 注: 如果有需要, 根节点可以不是项目
	Roots() []IData

	Children(d IData) []IData
}

数据管理器 数据管理器决定了软件可加载那些数据, 以什么方式加载, 又以什么方式呈现给用户 数据管理器的职责: 1 确保内存中的数据对象和数据库中的数据同步 2 决定数据对象之间的关系 3 自动管理对象占用的内存大小 4 对象的增删改查操作

func DataMan

func DataMan() IDataMan

获取数据管理器 注: 如果未指定管理器, 则系统将使用默认的DefaultDataMan, 且不能再次更改

type IDataVersion

type IDataVersion interface {
	// 数据版本, 用一个字符串以区分同名数据的不同版本
	// 例如"张三4月修改", "来自于数模等"
	DataVersion() string
}

type IFieldID

type IFieldID interface {
	// Field identifier
	// Current version supports single-level fields only
	// If empty, the item will be categorized as "unspecified"
	FieldID() string
}

type IWellBasic

type IWellBasic interface {
	IData

	// 井口坐标, x为东西方向, y为南北方向
	WellLoc() (x, y float64)

	// 井型, 正钻井, 废弃井, 生产井
	WellStage() string

	// 井别, 油,气, 水...
	WellType() string

	// 是否直井
	IsVertWell() bool
}

井(筒)数据

type IWellID

type IWellID interface {
	// 井的标识,井号
	// 我们的软件以这个标识区分不同井, ID相同则井相同, ID不同则井不同
	// 如果数据不属于任何井(例如地震测网)则此标识为空
	WellID() string
}

type IWellLog

type IWellLog interface {
	IData
	// 数据名称, DEPTH, GR...
	WellLogName()

	// 起始深度
	Top() float32

	// 终止深度
	Bottom() float32

	// 数据
	WellLogData() FBlock32
}

测井数据

type IZone

type IZone interface {
	IData
	// 起始深度
	Top() float32

	// 终止深度
	Bottom() float32
}

层位数据

type PrjModel

type PrjModel struct {
	gui.GuiModel
	// contains filtered or unexported fields
}

数据树模型

func (*PrjModel) ColCount

func (m *PrjModel) ColCount() int

指定节点下的子结点的列数

func (*PrjModel) Data

func (m *PrjModel) Data(idx gui.ModelIndex, role gui.ItemDataRole) interface{}

获取单元格数据

func (*PrjModel) Flags

func (m *PrjModel) Flags(idx gui.ModelIndex) gui.ItemFlags

子节点的属性标记, 例如是否可选

func (*PrjModel) HeaderData

func (m *PrjModel) HeaderData(section int, vertical bool, role gui.ItemDataRole) interface{}

func (*PrjModel) Index

func (m *PrjModel) Index(row, col int, parent gui.ModelIndex) gui.ModelIndex

获取parent下第row行col列的索引

func (*PrjModel) Init

func (m *PrjModel) Init(self gui.IGuiModel)

func (*PrjModel) Parent

func (m *PrjModel) Parent(idx gui.ModelIndex) gui.ModelIndex

获取父节点的索引

func (*PrjModel) Refresh

func (m *PrjModel) Refresh()

func (*PrjModel) RowCount

func (m *PrjModel) RowCount(parent gui.ModelIndex) int

指定节点下子结点的行数

func (*PrjModel) Sort

func (this *PrjModel) Sort(column int, desc bool)

type PrjView

type PrjView struct {
	gui.TreeView
	// contains filtered or unexported fields
}

////////////////////////////////////////////////////////////

func NewPrjView

func NewPrjView() *PrjView

func (*PrjView) Init

func (this *PrjView) Init(self gui.IWidget)

func (*PrjView) PrjModel

func (this *PrjView) PrjModel() *PrjModel

func (*PrjView) PromptCreateProject

func (this *PrjView) PromptCreateProject()

type Project

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

func (*Project) Close

func (this *Project) Close()

func (*Project) DBLocation

func (this *Project) DBLocation() string

数据库的位置

func (*Project) DataID

func (this *Project) DataID() string

func (*Project) DataName

func (this *Project) DataName() string

func (*Project) DirtyList

func (this *Project) DirtyList() []string

func (*Project) Ini

func (this *Project) Ini() core.IIni

func (*Project) IsLoadFailed

func (this *Project) IsLoadFailed() bool

项目是否加载失败

func (*Project) IsLoaded

func (this *Project) IsLoaded() bool

项目是否已加载 未加载的项目只知道名称, 已加载的项目才能读取数据

func (*Project) Load

func (this *Project) Load() error

打开项目

func (*Project) ProjectFullPath

func (this *Project) ProjectFullPath() string

项目的完整路径

func (*Project) ProjectName

func (this *Project) ProjectName() string

项目名称, 等同于目录名

func (*Project) ProjectType

func (this *Project) ProjectType() string

项目类型, 即后台数据类型

func (*Project) Save

func (this *Project) Save() error

type Well

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

func (*Well) DataID

func (this *Well) DataID() string

func (*Well) DataName

func (this *Well) DataName() string

func (*Well) IsUnderWell

func (this *Well) IsUnderWell() bool

分类下的井, 子节点应该是数据 不在分类下的井, 子节点应该是分类, 再下一级才是数据

func (*Well) WellID

func (this *Well) WellID() string

func (*Well) WellName

func (this *Well) WellName() string

Jump to

Keyboard shortcuts

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