Documentation ¶
Index ¶
- type Field
- type FieldList
- func (list FieldList) BasicType() FieldList
- func (list FieldList) DerivedType() FieldList
- func (list FieldList) DistinctTypes() []Type
- func (list FieldList) Filter(predicate func(*Field) bool) FieldList
- func (list FieldList) FormalParams() Identifiers
- func (list FieldList) Names() Identifiers
- func (list FieldList) NoAuto() FieldList
- func (list FieldList) NoPointers() FieldList
- func (list FieldList) NoPrimary() FieldList
- func (list FieldList) NoSkips() FieldList
- func (list FieldList) Pointers() FieldList
- func (list FieldList) SqlNames() Identifiers
- func (list FieldList) WhereClauses() Identifiers
- type Identifiers
- type Index
- type Node
- type SqlEncode
- type TableDescription
- func (table *TableDescription) ColumnNames(withAuto bool) Identifiers
- func (t *TableDescription) HasLastInsertId() bool
- func (t *TableDescription) HasPrimaryKey() bool
- func (t *TableDescription) NumColumnNames(withAuto bool) int
- func (t *TableDescription) SafePrimary() Field
- func (t *TableDescription) SimpleFields() FieldList
- 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) FlatMap(fn func(Type) []Type) 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) Map(fn func(Type) Type) TypeSet
- 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Node SqlName string Encode SqlEncode `json:",omitempty" yaml:",omitempty"` Tags *Tag `json:",omitempty" yaml:",omitempty"` }
func (*Field) AutoIncrement ¶ added in v0.13.0
func (*Field) IsExported ¶
func (*Field) NaturalKey ¶ added in v0.13.0
func (*Field) PrimaryKey ¶ added in v0.13.0
type FieldList ¶
type FieldList []*Field
func (FieldList) BasicType ¶ added in v0.17.0
BasicType returns all the fields that have basic (primitive) types.
func (FieldList) DerivedType ¶ added in v0.17.0
DerivedType returns all the fields that have have derived types.
func (FieldList) DistinctTypes ¶
func (FieldList) FormalParams ¶
func (list FieldList) FormalParams() Identifiers
func (FieldList) Names ¶
func (list FieldList) Names() Identifiers
func (FieldList) NoAuto ¶ added in v0.12.0
NoPrimary returns all the fields except any marked auto-increment.
func (FieldList) NoPointers ¶ added in v0.12.0
Pointers returns only the fields that have non-pointer types.
func (FieldList) NoPrimary ¶ added in v0.12.0
NoPrimary returns all the fields except any marked primary.
func (FieldList) SqlNames ¶
func (list FieldList) SqlNames() Identifiers
func (FieldList) WhereClauses ¶
func (list FieldList) WhereClauses() Identifiers
type Identifiers ¶
type Identifiers []string
func (Identifiers) MkString ¶
func (ids Identifiers) MkString(sep string) string
func (Identifiers) MkString3 ¶
func (ids Identifiers) MkString3(before, separator, after string) string
func (Identifiers) MkString3W ¶
func (ids Identifiers) MkString3W(w io.Writer, before, separator, after string)
type Index ¶
func (*Index) JoinedNames ¶
type TableDescription ¶
type TableDescription struct { Type string Name string Fields FieldList Index []*Index `json:",omitempty" yaml:",omitempty"` Primary *Field `json:",omitempty" yaml:",omitempty"` // compound primaries are not supported }
func (*TableDescription) ColumnNames ¶
func (table *TableDescription) ColumnNames(withAuto bool) Identifiers
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) SafePrimary ¶
func (t *TableDescription) SafePrimary() Field
func (*TableDescription) SimpleFields ¶
func (t *TableDescription) SimpleFields() FieldList
type Type ¶
type Type struct { Name string // name of source code type. PkgPath string `json:",omitempty" yaml:",omitempty"` // package name (full path) PkgName string `json:",omitempty" yaml:",omitempty"` // package name (short name) IsPtr bool `json:",omitempty" yaml:",omitempty"` IsScanner bool `json:",omitempty" yaml:",omitempty"` IsValuer bool `json:",omitempty" yaml:",omitempty"` Base Kind // underlying source code kind. }
func (Type) IsBasicType ¶ added in v0.17.0
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) Filter ¶
Filter returns a new TypeSet whose elements return true for func. The original set is not modified
func (TypeSet) FlatMap ¶
FlatMap returns a new TypeSet by transforming every element with a function fn that returns zero or more items in a slice. The resulting list may have a different size to the original list. The original list is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
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) Map ¶
Map returns a new TypeSet by transforming every element with a function fn. The original set is not modified.
This is a domain-to-range mapping function. For bespoke transformations to other types, copy and modify this method appropriately.
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 TypeSets 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. The original set is not modified
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.