Documentation
¶
Overview ¶
Package objecttables
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
Package objecttables
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
Package objecttables
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
Index ¶
- Constants
- func CalcKeys[K comparable](u any) []K
- func ClearTableIdx()
- func GetClass(bs []byte) string
- func GetTableIdx(table string) (int, bool)
- func GetTableName(idx int) (string, bool)
- func MetaEqual[V comparable](t TableI[V], o TableI[V]) bool
- func MkFactList[T FactI[any]](items []T) []ut.Optional[FactI[any]]
- func PrintTableIndexes() string
- func ReadTable(name string) ([][]string, error)
- func StoreTableIdx(table string) int
- type AlphaNode
- func (an *AlphaNode[K]) AddFacts(facts []ut.Optional[FactI[K]])
- func (an *AlphaNode[K]) AddMods(mods []FactMod[K])
- func (an *AlphaNode[K]) Clear()
- func (an *AlphaNode[K]) GetTable() TableI[FactI[K]]
- func (an *AlphaNode[K]) Propagate()
- func (an *AlphaNode[K]) SetChild(child NodeI[K])
- func (an *AlphaNode[K]) String() string
- type BetaNode
- type Bip
- type CombiningType
- type Fact
- func (f *Fact[K]) CreationTime() time.Time
- func (f *Fact[K]) Equals(o FactI[K]) bool
- func (f *Fact[K]) FromBytes(buf []byte) FactI[K]
- func (f *Fact[K]) Gc() bool
- func (f *Fact[K]) Keys() []K
- func (f *Fact[K]) SetTix(t int)
- func (f *Fact[K]) Table() string
- func (f *Fact[K]) Tix() int
- func (f *Fact[K]) ToBytes() []byte
- type FactI
- type FactMod
- type Group
- type GroupBy
- type GroupSelect
- type GroupSelection
- type JoinType
- type NodeI
- type OrderBy
- type Pred
- type ReteNetwork
- type Rowi
- type SortDir
- type Table
- func (t *Table[V]) AddRow1(r Rowi[V])
- func (t *Table[V]) AddRowF1(v ut.Optional[V])
- func (t *Table[V]) AddRowFN(vs []ut.Optional[V])
- func (t *Table[V]) AddRowsFN(vs []ut.Optional[V])
- func (t *Table[V]) Clear()
- func (t *Table[any]) CmpCsv(csvs [][]string) bool
- func (t *Table[V]) ColumnCount() int
- func (t *Table[V]) Columns() []string
- func (t *Table[V]) CrossJoin(o TableI[V]) TableI[V]
- func (t *Table[V]) DeleteF1(of ut.Optional[V])
- func (t *Table[V]) Except(o TableI[V]) TableI[V]
- func (t *Table[V]) ExceptAll(o TableI[V]) TableI[V]
- func (t *Table[V]) FullJoin(o TableI[V], preds []Bip[V]) TableI[V]
- func (t *Table[V]) Get(row, col int) ut.Optional[V]
- func (t *Table[V]) GetValues() []ut.Optional[V]
- func (t *Table[V]) GroupBy(groups []GroupBy) *Group[V]
- func (t *Table[V]) InnerJoin(o TableI[V], preds []Bip[V]) TableI[V]
- func (t *Table[V]) Intersect(o TableI[V]) TableI[V]
- func (t *Table[V]) IntersectAll(o TableI[V]) TableI[V]
- func (t *Table[V]) IsEmpty() bool
- func (t *Table[V]) IsValue() bool
- func (t *Table[V]) LeftJoin(o TableI[V], preds []Bip[V]) TableI[V]
- func (t *Table[V]) Limit(offset, limit int)
- func (t *Table[V]) NaturalJoin(o TableI[V]) TableI[V]
- func (t *Table[V]) OrderBy(obs []OrderBy)
- func (t *Table[V]) RemDuplicates() TableI[V]
- func (t *Table[V]) RightJoin(o TableI[V], preds []Bip[V]) TableI[V]
- func (t *Table[V]) RowCount() int
- func (t *Table[V]) Rows() []Rowi[V]
- func (t *Table[V]) SameTables(o TableI[V]) bool
- func (t *Table[V]) Selection(distinct bool, selections []TableSelect) TableI[any]
- func (t *Table[V]) String() string
- func (t *Table[V]) TableCount() int
- func (t *Table[V]) Tables() []int
- func (t *Table[V]) Union(o TableI[V]) TableI[V]
- func (t *Table[V]) UnionAll(o TableI[V]) TableI[V]
- func (t *Table[V]) UpdateRowF1(of ut.Optional[V])
- type TableI
- type TableSelect
- type TableSelection
- type TransactionType
Constants ¶
const TIX = "Tixx"
Variables ¶
This section is empty.
Functions ¶
func CalcKeys ¶
func CalcKeys[K comparable](u any) []K
func ClearTableIdx ¶
func ClearTableIdx()
func GetTableIdx ¶
func GetTableName ¶
func MetaEqual ¶
func MetaEqual[V comparable](t TableI[V], o TableI[V]) bool
MetaEqual check whether the meta datas of two columns are equal
func MkFactList ¶
MkFactList make a list of optional FactI[any] types of list that inherits FactI[any]
func PrintTableIndexes ¶
func PrintTableIndexes() string
func StoreTableIdx ¶
Types ¶
type AlphaNode ¶
type AlphaNode[K comparable] struct { // contains filtered or unexported fields }
func NewAlphaNode ¶
type BetaNode ¶
type BetaNode[K comparable] struct { // contains filtered or unexported fields }
func NewBetaNode ¶
type Bip ¶
type Bip[V comparable] struct { No int Test func(ut.Optional[V], ut.Optional[V]) bool Table1, Table2 int }
type CombiningType ¶
type CombiningType int
const ( UNION CombiningType = iota UNION_ALL INTERSECT INTERSECT_ALL EXCEPT EXCEPT_ALL END_COMBINE )
postgresql combining queries types
func CombTypeOf ¶
func CombTypeOf(str string) CombiningType
func (CombiningType) String ¶
func (i CombiningType) String() string
type Fact ¶
type Fact[K comparable] struct { Tablex string `json:"table-name"` Tixx int `json:"-"` CreateTime time.Time Cg bool }
func (*Fact[K]) CreationTime ¶
type FactMod ¶
type FactMod[K comparable] struct { Trans TransactionType Table string Fact FactI[K] Tix int }
func NewFactMod ¶
func NewFactMod[K comparable](trans TransactionType, table string, fact FactI[K]) FactMod[K]
type Group ¶
type Group[V comparable] struct { Group *ut.SimpleMultiKeyStore[any, V] Keys []string Table int }
Group grouping data output to the selection stage. The groups are stored in the Group field als the string of a list of keys
type GroupSelect ¶
type GroupSelect struct {
// contains filtered or unexported fields
}
func NewGroupSelect ¶
func NewGroupSelect(table int, field string, sel GroupSelection) GroupSelect
type GroupSelection ¶
type GroupSelection int
const ( COUNT GroupSelection = iota AVG MIN MAX SUM GRP_SELECT_NONE )
func (GroupSelection) String ¶
func (i GroupSelection) String() string
type NodeI ¶
type NodeI[K comparable] interface { // GetTable the facts of an alpha node and the joined facts of a beta node are stored in a Table of objects */ GetTable() TableI[FactI[K]] // SetChild the nodes are part of a binary tree network, so each alpha and beta node has one child and SetChild(NodeI[K]) // Propagate propagate the facts of the alpha nodes through the rete network */ Propagate() // Clear all data to make network ready for new calculations */ Clear() String() string // contains filtered or unexported methods }
type ReteNetwork ¶
type ReteNetwork[K comparable] struct { Modified bool NoIterations uint64 // contains filtered or unexported fields }
func NewReteNetwork ¶
func NewReteNetwork[K comparable](as []*AlphaNode[K], bs []*BetaNode[K]) *ReteNetwork[K]
func (*ReteNetwork[K]) AddMods ¶
func (r *ReteNetwork[K]) AddMods(ms []FactMod[K])
func (*ReteNetwork[K]) Clear ¶
func (r *ReteNetwork[K]) Clear()
func (*ReteNetwork[K]) GetTable ¶
func (r *ReteNetwork[K]) GetTable() TableI[FactI[K]]
func (*ReteNetwork[K]) HasTable ¶
func (r *ReteNetwork[K]) HasTable(tix int) bool
func (*ReteNetwork[K]) Propagate ¶
func (r *ReteNetwork[K]) Propagate()
type Rowi ¶
type Rowi[V comparable] interface { IsValue() bool Values() []ut.Optional[V] ValuesQ(int) []ut.Optional[V] Add(optional ut.Optional[V]) HasTable(int) bool Tables() ([]int, bool) String() string Equals(rowi Rowi[V]) bool SetTables(tables []int) Update(i int, of ut.Optional[V]) Delete(i int) // contains filtered or unexported methods }
func NewNullRow ¶
func NewNullRow[V comparable](n int) Rowi[V]
func NewRow ¶
func NewRow[V comparable]() Rowi[V]
type Table ¶
type Table[V comparable] struct { // contains filtered or unexported fields }
func NewTable ¶
func NewTable[V comparable]() *Table[V]
func NewTablePs ¶
func NewTablePs[V comparable](ts []int, cs []string) *Table[V]
func SelectGroup ¶
func SelectGroup[V comparable](res *Group[V], selections []GroupSelect) *Table[any]
func (*Table[V]) ColumnCount ¶
func (*Table[V]) Intersect ¶
Intersect adds common rows of two tables, eliminates the duplicate rows
func (*Table[V]) IntersectAll ¶
Intersect adds common rows of two tables, eliminates the duplicate rows
func (*Table[V]) Limit ¶
Limit takes a subset of the table rows starting at 'offset' index taking 'limit' rows of the table, below some SQL usages: SELECT * FROM Customers LIMIT 3; first 3 records SELECT * FROM Customers LIMIT 3 OFFSET 3; Returns rows 4, 5, and 6 SELECT * FROM Employees ORDER BY salary DESC LIMIT 5; Returns the five employees with the highest salaries. SELECT DISTINCT salary FROM Employees ORDER BY salary DESC LIMIT 1 OFFSET 1; Returns the second highest salary from the Employees table.
func (*Table[V]) NaturalJoin ¶
func (*Table[V]) RemDuplicates ¶
func (*Table[V]) SameTables ¶
func (*Table[V]) Selection ¶
func (t *Table[V]) Selection(distinct bool, selections []TableSelect) TableI[any]
func (*Table[V]) TableCount ¶
func (*Table[V]) UnionAll ¶
UnionAll combines the rows of two tables, does not eliminate the duplicate rows
func (*Table[V]) UpdateRowF1 ¶
type TableI ¶
type TableI[V comparable] interface { IsValue() bool Rows() []Rowi[V] AddRow1(Rowi[V]) AddRowF1(v ut.Optional[V]) UpdateRowF1(of ut.Optional[V]) DeleteF1(of ut.Optional[V]) AddRowFN(v []ut.Optional[V]) AddRowsFN(v []ut.Optional[V]) RowCount() int TableCount() int ColumnCount() int Clear() Tables() []int Columns() []string SameTables(TableI[V]) bool InnerJoin(TableI[V], []Bip[V]) TableI[V] NaturalJoin(TableI[V]) TableI[V] CrossJoin(TableI[V]) TableI[V] LeftJoin(TableI[V], []Bip[V]) TableI[V] RightJoin(TableI[V], []Bip[V]) TableI[V] FullJoin(TableI[V], []Bip[V]) TableI[V] Union(TableI[V]) TableI[V] UnionAll(TableI[V]) TableI[V] Intersect(TableI[V]) TableI[V] IntersectAll(TableI[V]) TableI[V] Except(TableI[V]) TableI[V] ExceptAll(TableI[V]) TableI[V] IsEmpty() bool GetValues() []ut.Optional[V] Selection(bool, []TableSelect) TableI[any] OrderBy([]OrderBy) RemDuplicates() TableI[V] Limit(int, int) GroupBy([]GroupBy) *Group[V] Get(int, int) ut.Optional[V] }
TableI for the natural join operation on two tables the value type V needs to be comparable
type TableSelect ¶
type TableSelect struct {
// contains filtered or unexported fields
}
func NewTableSelect ¶
func NewTableSelect(table int, field, alias string, sel TableSelection) TableSelect
type TableSelection ¶
type TableSelection int
const ( ALL_TABLES TableSelection = iota SELECT_TABLES SELECT_VALUES TBL_SELECT_NONE )
func (TableSelection) String ¶
func (i TableSelection) String() string
type TransactionType ¶
type TransactionType int
const ( UPDATE TransactionType = iota INSERT DELETE ERROR NONE )
func (TransactionType) String ¶
func (i TransactionType) String() string
Source Files
¶
- combiningtype_string.go
- fact.go
- facts0.go
- facts1.go
- facts2.go
- groupselection_string.go
- jointype_string.go
- modification.go
- pred.go
- rete.go
- row.go
- table.go
- table_csv.go
- table_except.go
- table_fulljoin.go
- table_groupby.go
- table_intersect.go
- table_orderby.go
- table_select.go
- table_union.go
- tableindex.go
- tableselection_string.go
- transactiontype_string.go
- utils.go