Documentation ¶
Index ¶
- Constants
- Variables
- func DeserializeSetPattern(ctx *core.Context, it *jsoniter.Iterator, pattern core.Pattern, try bool) (_ core.Pattern, finalErr error)
- func NewAddElemMutation(path core.Path) core.Mutation
- func NewRemoveElemMutation(path core.Path) core.Mutation
- type Set
- func (set *Set) Add(ctx *core.Context, elem core.Serializable)
- func (set *Set) Contains(ctx *core.Context, value core.Serializable) bool
- func (s *Set) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, ...) bool
- func (set *Set) Get(ctx *core.Context, keyVal core.StringLike) (core.Value, core.Bool)
- func (set *Set) GetElementByKey(ctx *core.Context, pathKey core.ElementKey) (core.Serializable, error)
- func (f *Set) GetGoMethod(name string) (*core.GoFunction, bool)
- func (set *Set) Has(ctx *core.Context, elem core.Serializable) core.Bool
- func (set *Set) IsEmpty(ctx *core.Context) bool
- func (s *Set) IsMutable() bool
- func (s *Set) IsSharable(originState *core.GlobalState) (bool, string)
- func (s *Set) IsShared() bool
- func (s *Set) Iterator(ctx *core.Context, config core.IteratorConfiguration) core.Iterator
- func (s *Set) Migrate(ctx *core.Context, key core.Path, migration *core.FreeEntityMigrationArgs) (core.Value, error)
- func (set *Set) OnMutation(ctx *core.Context, microtask core.MutationCallbackMicrotask, ...) (core.CallbackHandle, error)
- func (s *Set) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, ...)
- func (s *Set) Prop(ctx *core.Context, name string) core.Value
- func (*Set) PropertyNames(ctx *core.Context) []string
- func (set *Set) Remove(ctx *core.Context, elem core.Serializable)
- func (set *Set) RemoveMutationCallback(ctx *core.Context, handle core.CallbackHandle)
- func (set *Set) RemoveMutationCallbackMicrotasks(ctx *core.Context)
- func (*Set) SetProp(ctx *core.Context, name string, value core.Value) error
- func (set *Set) SetURLOnce(ctx *core.Context, url core.URL) error
- func (s *Set) Share(originState *core.GlobalState)
- func (s *Set) SmartLock(state *core.GlobalState)
- func (s *Set) SmartUnlock(state *core.GlobalState)
- func (s *Set) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)
- func (set *Set) URL() (core.URL, bool)
- func (set *Set) Watcher(ctx *core.Context, config core.WatcherConfiguration) core.Watcher
- func (set *Set) WriteJSONRepresentation(ctx *core.Context, w *jsoniter.Stream, config core.JSONSerializationConfig, ...) error
- type SetConfig
- type SetPattern
- func (p *SetPattern) DefaultValue(ctx *core.Context) (core.Value, error)
- func (p *SetPattern) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, ...) bool
- func (p *SetPattern) GetMigrationOperations(ctx *core.Context, next core.Pattern, pseudoPath string) ([]core.MigrationOp, error)
- func (p *SetPattern) IsMutable() bool
- func (p *SetPattern) Iterator(ctx *core.Context, config core.IteratorConfiguration) core.Iterator
- func (n *SetPattern) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, ...)
- func (p *SetPattern) Random(ctx *core.Context, options ...core.Option) core.Value
- func (p *SetPattern) StringPattern() (core.StringPattern, bool)
- func (patt *SetPattern) Test(ctx *core.Context, v core.Value) bool
- func (p *SetPattern) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)
- func (p *SetPattern) WriteJSONRepresentation(ctx *core.Context, w *jsoniter.Stream, config core.JSONSerializationConfig, ...) error
Constants ¶
View Source
const ( AddElem core.SpecificMutationKind = iota + 1 RemoveElem )
View Source
const ( SERIALIZED_SET_PATTERN_ELEM_KEY = "element" SERIALIZED_SET_PATTERN_UNIQUENESS_KEY = "uniqueness" )
View Source
const (
DEFAULT_WATCHING_DEPTH = core.ShallowWatching
)
View Source
const (
INITIAL_SET_KEY_BUF = 2000
)
Variables ¶
View Source
var ( SET_PATTERN = &core.TypePattern{ Name: "Set", Type: reflect.TypeOf((*Set)(nil)), SymbolicValue: coll_symbolic.ANY_SET, CallImpl: func(typePattern *core.TypePattern, values []core.Serializable) (core.Pattern, error) { switch len(values) { case 0: return nil, commonfmt.FmtMissingArgument("element pattern") case 1: return nil, commonfmt.FmtMissingArgument("uniqueness") } elementPattern, ok := values[0].(core.Pattern) if !ok { return nil, core.FmtErrInvalidArgumentAtPos(elementPattern, 0) } uniqueness, ok := common.UniquenessConstraintFromValue(values[1]) if !ok { return nil, core.FmtErrInvalidArgumentAtPos(elementPattern, 1) } return NewSetPattern(SetConfig{ Element: elementPattern, Uniqueness: uniqueness, }), nil }, SymbolicCallImpl: func(ctx *symbolic.Context, values []symbolic.Value) (symbolic.Pattern, error) { switch len(values) { case 0: return nil, commonfmt.FmtMissingArgument("element pattern") case 1: return nil, commonfmt.FmtMissingArgument("uniqueness") } elementPattern, ok := values[0].(symbolic.Pattern) if !ok { return nil, commonfmt.FmtErrInvalidArgumentAtPos(0, "a pattern is expected") } uniqueness, err := common.UniquenessConstraintFromSymbolicValue(values[1], elementPattern) if err != nil { return nil, commonfmt.FmtErrInvalidArgumentAtPos(1, err.Error()) } return coll_symbolic.NewSetPatternWithElementPatternAndUniqueness(elementPattern, &uniqueness), nil }, } SET_PATTERN_PATTERN = &core.TypePattern{ Name: "set-pattern", Type: reflect.TypeOf((*SetPattern)(nil)), SymbolicValue: coll_symbolic.ANY_SET_PATTERN, } )
View Source
var ( ErrSetCanOnlyContainRepresentableValues = errors.New("a Set can only contain representable values") ErrValueDoesMatchElementPattern = errors.New("provided value does not match the element pattern") ErrValueWithSameKeyAlreadyPresent = errors.New("provided value has the same key as an already present element") ErrCannotAddDifferentElemWithSamePropertyValue = errors.New("cannot add different element with same property value") ErrPropertyUsedForUniquenessNoPresentInPattern = errors.New("property used for uniqueness is not present in element pattern") )
Functions ¶
func DeserializeSetPattern ¶
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func NewSetWithConfig ¶
func (*Set) GetElementByKey ¶
func (set *Set) GetElementByKey(ctx *core.Context, pathKey core.ElementKey) (core.Serializable, error)
func (*Set) GetGoMethod ¶
func (f *Set) GetGoMethod(name string) (*core.GoFunction, bool)
func (*Set) IsSharable ¶
func (s *Set) IsSharable(originState *core.GlobalState) (bool, string)
func (*Set) OnMutation ¶
func (set *Set) OnMutation(ctx *core.Context, microtask core.MutationCallbackMicrotask, config core.MutationWatchingConfiguration) (core.CallbackHandle, error)
func (*Set) PrettyPrint ¶
func (*Set) RemoveMutationCallback ¶
func (set *Set) RemoveMutationCallback(ctx *core.Context, handle core.CallbackHandle)
func (*Set) RemoveMutationCallbackMicrotasks ¶
func (*Set) Share ¶
func (s *Set) Share(originState *core.GlobalState)
func (*Set) SmartLock ¶
func (s *Set) SmartLock(state *core.GlobalState)
func (*Set) SmartUnlock ¶
func (s *Set) SmartUnlock(state *core.GlobalState)
func (*Set) ToSymbolicValue ¶
type SetConfig ¶
type SetConfig struct { Element core.Pattern Uniqueness common.UniquenessConstraint }
type SetPattern ¶
type SetPattern struct { core.NotCallablePatternMixin // contains filtered or unexported fields }
func NewSetPattern ¶
func NewSetPattern(config SetConfig) *SetPattern
func (*SetPattern) DefaultValue ¶
func (*SetPattern) GetMigrationOperations ¶
func (p *SetPattern) GetMigrationOperations(ctx *core.Context, next core.Pattern, pseudoPath string) ([]core.MigrationOp, error)
func (*SetPattern) IsMutable ¶
func (p *SetPattern) IsMutable() bool
func (*SetPattern) Iterator ¶
func (p *SetPattern) Iterator(ctx *core.Context, config core.IteratorConfiguration) core.Iterator
func (*SetPattern) PrettyPrint ¶
func (n *SetPattern) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)
func (*SetPattern) StringPattern ¶
func (p *SetPattern) StringPattern() (core.StringPattern, bool)
func (*SetPattern) ToSymbolicValue ¶
func (*SetPattern) WriteJSONRepresentation ¶
func (p *SetPattern) WriteJSONRepresentation(ctx *core.Context, w *jsoniter.Stream, config core.JSONSerializationConfig, depth int) error
Click to show internal directories.
Click to hide internal directories.