Documentation ¶
Index ¶
- Constants
- Variables
- func GetElementPathKeyFromKey(key string, uniqueness UniquenessConstraintType) core.ElementKey
- func GetUniqueKey(ctx *core.Context, args KeyRetrievalParams) string
- type CollectionIterator
- func (it *CollectionIterator) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, ...) bool
- func (it *CollectionIterator) HasNext(ctx *core.Context) bool
- func (it *CollectionIterator) IsMutable() bool
- func (it *CollectionIterator) Iterator(ctx *core.Context, config core.IteratorConfiguration) core.Iterator
- func (it *CollectionIterator) Key(ctx *core.Context) core.Value
- func (it *CollectionIterator) Next(ctx *core.Context) bool
- func (it *CollectionIterator) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, ...)
- func (it *CollectionIterator) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)
- func (it *CollectionIterator) Value(ctx *core.Context) core.Value
- type KeyRetrievalParams
- type UniquenessConstraint
- func DeserializeNextUniquenessConstraintFromJSON(it *jsoniter.Iterator) (UniquenessConstraint, error)
- func NewPropertyValueUniqueness(name string) *UniquenessConstraint
- func NewReprUniqueness() *UniquenessConstraint
- func NewTransientIdUniqueness() *UniquenessConstraint
- func NewURLUniqueness() *UniquenessConstraint
- func UniquenessConstraintFromSymbolicValue(val symbolic.Value, elementPattern symbolic.Pattern) (UniquenessConstraint, error)
- func UniquenessConstraintFromValue(val core.Value) (UniquenessConstraint, bool)
- func (c UniquenessConstraint) AddUrlIfNecessary(ctx *core.Context, container core.UrlHolder, element core.Value)
- func (c UniquenessConstraint) Equal(otherConstraint UniquenessConstraint) bool
- func (c UniquenessConstraint) ToSymbolicValue() symbolic.Value
- func (c UniquenessConstraint) ToValue() core.Serializable
- func (c UniquenessConstraint) WriteJSONRepresentation(w *jsoniter.Stream)
- type UniquenessConstraintType
Constants ¶
View Source
const ( URL_UNIQUENESS_NAME string = "url" REPR_UNIQUENESS_NAME string = "repr" TRANSIENT_ID_UNIQUENESS_NAME string = "transient-id" URL_UNIQUENESS_IDENT = core.Identifier(URL_UNIQUENESS_NAME) REPR_UNIQUENESS_IDENT = core.Identifier(REPR_UNIQUENESS_NAME) TRANSIENT_ID_UNIQUENESS_IDENT = core.Identifier(TRANSIENT_ID_UNIQUENESS_NAME) )
Variables ¶
View Source
var ( ErrFailedGetUniqueKeyNoURL = errors.New("failed to get unique key for value since it has no URL") ErrFailedGetUniqueKeyNoProps = errors.New("failed to get unique key for value since it has no properties") ErrFailedGetUniqueKeyPropMissing = errors.New("failed to get unique key for value since the property is missing") ErrPropertyBasedUniquenessRequireValuesToHaveTheProperty = errors.New("property-based uniqueness requires values to have the property") ErrReprBasedUniquenessRequireValuesToBeImmutable = errors.New("representation-based uniqueness requires values to be immutable") ErrTransientIDBasedUniquenessRequireValuesToHaveTransientID = errors.New("transient id-based uniqueness requires values to have a transient id") ErrUrlBasedUniquenessRequireValuesToBeUrlHolders = errors.New("URL-based uniqueness requires values to be URL holders") ErrContainerShouldHaveURL = errors.New("container should have a URL") ErrCannotAddURLToElemOfOtherContainer = errors.New("cannot add a URL to the element of an other container") UniqueKeyReprConfig = &core.ReprConfig{AllVisible: true} URL_UNIQUENESS_SYMB_IDENT = symbolic.NewIdentifier(URL_UNIQUENESS_IDENT.UnderlyingString()) REPR_UNIQUENESS_SYMB_IDENT = symbolic.NewIdentifier(REPR_UNIQUENESS_IDENT.UnderlyingString()) TRANSIENT_ID_UNIQUENESS_SYMB_IDENT = symbolic.NewIdentifier(TRANSIENT_ID_UNIQUENESS_IDENT.UnderlyingString()) EXPECTED_SYMB_VALUE_FOR_UNIQUENESS = fmt.Sprintf("#%s, #%s, #%s or a property name is expected", URL_UNIQUENESS_IDENT, REPR_UNIQUENESS_IDENT, TRANSIENT_ID_UNIQUENESS_IDENT, ) )
Functions ¶
func GetElementPathKeyFromKey ¶
func GetElementPathKeyFromKey(key string, uniqueness UniquenessConstraintType) core.ElementKey
func GetUniqueKey ¶
func GetUniqueKey(ctx *core.Context, args KeyRetrievalParams) string
GetUniqueKey computes the key of the provided value. For UniqueRepr and UniquePropertyValue uniqueness the key is written to the provided stream, so the returned string should be cloned before being stored. GetUniqueKey does not support retrieving the key for UniqueAddress uniqueness.
Types ¶
type CollectionIterator ¶
type CollectionIterator struct { HasNext_ func(*CollectionIterator, *core.Context) bool Next_ func(*CollectionIterator, *core.Context) bool Key_ func(*CollectionIterator, *core.Context) core.Value Value_ func(*CollectionIterator, *core.Context) core.Value }
func NewEmptyCollectionIterator ¶
func NewEmptyCollectionIterator() *CollectionIterator
func (*CollectionIterator) IsMutable ¶
func (it *CollectionIterator) IsMutable() bool
func (*CollectionIterator) Iterator ¶
func (it *CollectionIterator) Iterator(ctx *core.Context, config core.IteratorConfiguration) core.Iterator
func (*CollectionIterator) PrettyPrint ¶
func (it *CollectionIterator) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)
func (*CollectionIterator) ToSymbolicValue ¶
type KeyRetrievalParams ¶
type KeyRetrievalParams struct { Value core.Serializable Config UniquenessConstraint Container core.Value Stream *jsoniter.Stream JSONSerializationConfig core.JSONSerializationConfig }
type UniquenessConstraint ¶
type UniquenessConstraint struct { Type UniquenessConstraintType PropertyName core.PropertyName //set if UniquePropertyValue }
func DeserializeNextUniquenessConstraintFromJSON ¶
func DeserializeNextUniquenessConstraintFromJSON(it *jsoniter.Iterator) (UniquenessConstraint, error)
func NewPropertyValueUniqueness ¶
func NewPropertyValueUniqueness(name string) *UniquenessConstraint
func NewReprUniqueness ¶
func NewReprUniqueness() *UniquenessConstraint
func NewTransientIdUniqueness ¶
func NewTransientIdUniqueness() *UniquenessConstraint
func NewURLUniqueness ¶
func NewURLUniqueness() *UniquenessConstraint
func UniquenessConstraintFromValue ¶
func UniquenessConstraintFromValue(val core.Value) (UniquenessConstraint, bool)
func (UniquenessConstraint) AddUrlIfNecessary ¶
func (UniquenessConstraint) Equal ¶
func (c UniquenessConstraint) Equal(otherConstraint UniquenessConstraint) bool
func (UniquenessConstraint) ToSymbolicValue ¶
func (c UniquenessConstraint) ToSymbolicValue() symbolic.Value
func (UniquenessConstraint) ToValue ¶
func (c UniquenessConstraint) ToValue() core.Serializable
func (UniquenessConstraint) WriteJSONRepresentation ¶
func (c UniquenessConstraint) WriteJSONRepresentation(w *jsoniter.Stream)
type UniquenessConstraintType ¶
type UniquenessConstraintType int
const ( UniqueRepr UniquenessConstraintType = iota + 1 UniqueURL UniquePropertyValue UniqueTransientID )
Click to show internal directories.
Click to hide internal directories.