Documentation
¶
Index ¶
- Variables
- type Dialect
- type Field
- type FieldList
- type Index
- type Node
- type SqlEncode
- type SqlToken
- type TableDescription
- type Type
- type TypeSet
- func (set TypeSet) Add(i ...Type) TypeSet
- func (set TypeSet) Append(more ...Type) TypeSet
- func (set TypeSet) Cardinality() int
- func (set *TypeSet) Clear()
- func (set TypeSet) Clone() TypeSet
- func (set TypeSet) Contains(i Type) bool
- func (set TypeSet) ContainsAll(i ...Type) bool
- func (set TypeSet) CountBy(predicate func(Type) bool) (result int)
- func (set TypeSet) Difference(other TypeSet) TypeSet
- func (set TypeSet) Equals(other TypeSet) bool
- func (set TypeSet) Exists(fn func(Type) bool) bool
- func (set TypeSet) Filter(fn func(Type) bool) TypeSet
- func (set TypeSet) Forall(fn func(Type) bool) bool
- func (set TypeSet) Foreach(fn func(Type))
- func (set TypeSet) Intersect(other TypeSet) TypeSet
- func (set TypeSet) IsEmpty() bool
- func (set TypeSet) IsSequence() bool
- func (set TypeSet) IsSet() bool
- func (set TypeSet) IsSubset(other TypeSet) bool
- func (set TypeSet) IsSuperset(other TypeSet) bool
- func (set TypeSet) MaxBy(less func(Type, Type) bool) Type
- func (set TypeSet) MinBy(less func(Type, Type) bool) Type
- func (set TypeSet) NonEmpty() bool
- func (set TypeSet) Partition(p func(Type) bool) (TypeSet, TypeSet)
- func (set TypeSet) Remove(i Type)
- func (set TypeSet) Send() <-chan Type
- func (set TypeSet) Size() int
- func (set TypeSet) SymmetricDifference(other TypeSet) TypeSet
- func (set TypeSet) ToInterfaceSlice() []interface{}
- func (set TypeSet) ToSlice() []Type
- func (set TypeSet) Union(other TypeSet) TypeSet
Constants ¶
This section is empty.
Variables ¶
var AllDialects = []Dialect{Sqlite, Postgres, Mysql}
var Dialects []string
Functions ¶
This section is empty.
Types ¶
type Dialect ¶
type Dialect interface { TableDDL(*TableDescription) string InsertDML(*TableDescription) string UpdateDML(*TableDescription) string DeleteDML(*TableDescription, FieldList) string TruncateDDL(tableName string, force bool) []string //Param(int) string CreateTableSettings() string FieldAsColumn(*Field) string ReplacePlaceholders(sql string) string Placeholders(n int) string String() string }
var Mysql Dialect = mysql{}
var Postgres Dialect = postgres{}
var Sqlite Dialect = sqlite{}
type Field ¶
func (*Field) IsExported ¶
type TableDescription ¶
type TableDescription struct { Type string Name string Fields FieldList Index []*Index Primary *Field // compound primaries are not supported }
func (*TableDescription) ColumnNames ¶
func (t *TableDescription) ColumnNames(withAuto bool) []string
func (*TableDescription) HasLastInsertId ¶
func (t *TableDescription) HasLastInsertId() bool
func (*TableDescription) HasPrimaryKey ¶
func (t *TableDescription) HasPrimaryKey() bool
func (*TableDescription) NumColumnNames ¶
func (t *TableDescription) NumColumnNames(withAuto bool) int
func (*TableDescription) SimpleFields ¶
func (t *TableDescription) SimpleFields() FieldList
type Type ¶
type Type struct { PkgPath string // package name (full path) PkgName string // package name (short name) Name string // name of source code type. IsPtr bool IsScanner bool IsValuer bool Base Kind // underlying source code kind. }
func (Type) NullableValue ¶
type TypeSet ¶
type TypeSet map[Type]struct{}
TypeSet is the primary type that represents a set
func BuildTypeSetFromChan ¶
BuildTypeSetFromChan constructs a new TypeSet from a channel that supplies a sequence of values until it is closed. The function doesn't return until then.
func ConvertTypeSet ¶
ConvertTypeSet constructs a new set containing the supplied values, if any. The returned boolean will be false if any of the values could not be converted correctly.
func NewTypeSet ¶
NewTypeSet creates and returns a reference to an empty set.
func (TypeSet) Cardinality ¶
Cardinality returns how many items are currently in the set. This is a synonym for Size.
func (*TypeSet) Clear ¶
func (set *TypeSet) Clear()
Clear clears the entire set to be the empty set.
func (TypeSet) Clone ¶
Clone returns a shallow copy of the map. It does not clone the underlying elements.
func (TypeSet) ContainsAll ¶
ContainsAll determines if the given items are all in the set
func (TypeSet) CountBy ¶
CountBy gives the number elements of TypeSet that return true for the passed predicate.
func (TypeSet) Difference ¶
Difference returns a new set with items in the current set but not in the other set
func (TypeSet) Equals ¶
Equals determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.
func (TypeSet) Exists ¶
Exists applies a predicate function to every element in the set. If the function returns true, the iteration terminates early. The returned value is true if an early return occurred. or false if all elements were visited without finding a match.
func (TypeSet) Forall ¶
Forall applies a predicate function to every element in the set. If the function returns false, the iteration terminates early. The returned value is true if all elements were visited, or false if an early return occurred.
Note that this method can also be used simply as a way to visit every element using a function with some side-effects; such a function must always return true.
func (TypeSet) Foreach ¶
Foreach iterates over TypeSet and executes the passed func against each element.
func (TypeSet) IsSuperset ¶
IsSuperset determines if every item of this set is in the other set.
func (TypeSet) MaxBy ¶
MaxBy returns an element of TypeSet containing the maximum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally maximal, the first such element is returned. Panics if there are no elements.
func (TypeSet) MinBy ¶
MinBy returns an element of TypeSet containing the minimum value, when compared to other elements using a passed func defining ‘less’. In the case of multiple items being equally minimal, the first such element is returned. Panics if there are no elements.
func (TypeSet) Partition ¶
Partition returns two new TypeLists whose elements return true or false for the predicate, p. The first result consists of all elements that satisfy the predicate and the second result consists of all elements that don't. The relative order of the elements in the results is the same as in the original list.
func (TypeSet) Send ¶
Send returns a channel that will send all the elements in order. A goroutine is created to send the elements; this only terminates when all the elements have been consumed
func (TypeSet) Size ¶
Size returns how many items are currently in the set. This is a synonym for Cardinality.
func (TypeSet) SymmetricDifference ¶
SymmetricDifference returns a new set with items in the current set or the other set but not in both.
func (TypeSet) ToInterfaceSlice ¶
func (set TypeSet) ToInterfaceSlice() []interface{}
ToInterfaceSlice returns the elements of the current set as a slice of arbitrary type.