predicate

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2017 License: Apache-2.0 Imports: 7 Imported by: 25

Documentation

Overview

Package predicate allows to build and manipulate BadWolf predicates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID represents a predicate ID.

func (*ID) String

func (i *ID) String() string

String converts a ID to its string form.

type Predicate

type Predicate struct {
	// contains filtered or unexported fields
}

Predicate represents a BadWolf predicate.

func NewImmutable

func NewImmutable(id string) (*Predicate, error)

NewImmutable creates a new immutable predicate.

func NewTemporal

func NewTemporal(id string, t time.Time) (*Predicate, error)

NewTemporal creates a new temporal predicate.

func Parse

func Parse(s string) (*Predicate, error)

Parse converts a pretty printed predicate into a predicate.

func (*Predicate) ID

func (p *Predicate) ID() ID

ID returns the ID of the predicate.

func (*Predicate) String

func (p *Predicate) String() string

String returns the pretty printed version of the predicate.

func (*Predicate) TimeAnchor

func (p *Predicate) TimeAnchor() (*time.Time, error)

TimeAnchor attempts to return the time anchor of a predicate if its type is temporal.

func (*Predicate) Type

func (p *Predicate) Type() Type

Type returns the type of the predicate.

func (*Predicate) UUID added in v0.5.0

func (p *Predicate) UUID() uuid.UUID

UUID returns a global unique identifier for the given predicate. It is implemented as the SHA1 UUID of the predicate values.

type Type

type Type uint8

Type describes the two type of predicates in BadWolf

const (
	// Immutable predicates are always valid and not bound to any time anchor.
	Immutable Type = iota
	// Temporal predicates are anchored in the time continuum and valid depending
	// on the reasoning engine and the granularity of the reasoning.
	Temporal
)

func (Type) String

func (t Type) String() string

String returns a pretty printed type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL