 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package compiler knows how to build the Go representation of a SpiceDB schema text.
Index ¶
Constants ¶
const Ellipsis = "..."
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseCompilerError ¶ added in v1.5.0
type BaseCompilerError struct {
	BaseMessage string
	// contains filtered or unexported fields
}
    BaseCompilerError defines an error with contains the base message of the issue that occurred.
type CompiledSchema ¶ added in v1.14.0
type CompiledSchema struct {
	// ObjectDefinitions holds the object definitions in the schema.
	ObjectDefinitions []*core.NamespaceDefinition
	// CaveatDefinitions holds the caveat definitions in the schema.
	CaveatDefinitions []*core.CaveatDefinition
	// OrderedDefinitions holds the object and caveat definitions in the schema, in the
	// order in which they were found.
	OrderedDefinitions []SchemaDefinition
	// contains filtered or unexported fields
}
    CompiledSchema is the result of compiling a schema when there are no errors.
func Compile ¶
func Compile(schema InputSchema, prefix ObjectPrefixOption, opts ...Option) (*CompiledSchema, error)
Compile compilers the input schema into a set of namespace definition protos.
func (CompiledSchema) SourcePositionToRunePosition ¶ added in v1.31.0
func (cs CompiledSchema) SourcePositionToRunePosition(source input.Source, position input.Position) (int, error)
SourcePositionToRunePosition converts a source position to a rune position.
type DSLNode ¶ added in v1.31.0
type DSLNode interface {
	GetType() dslshape.NodeType
	GetString(predicateName string) (string, error)
	GetInt(predicateName string) (int, error)
	Lookup(predicateName string) (DSLNode, error)
}
    DSLNode is a node in the DSL AST.
type InputSchema ¶
type InputSchema struct {
	// Source is the source of the schema being compiled.
	Source input.Source
	// Schema is the contents being compiled.
	SchemaString string
}
    InputSchema defines the input for a Compile.
type NodeChain ¶ added in v1.31.0
type NodeChain struct {
	// contains filtered or unexported fields
}
    NodeChain is a chain of nodes in the DSL AST.
func PositionToAstNodeChain ¶ added in v1.31.0
func PositionToAstNodeChain(schema *CompiledSchema, source input.Source, position input.Position) (*NodeChain, error)
PositionToAstNodeChain returns the AST node, and its parents (if any), found at the given position in the source, if any.
func (*NodeChain) FindNodeOfType ¶ added in v1.31.0
FindNodeOfType returns the first node of the given type in the chain, if any.
func (*NodeChain) ForRunePosition ¶ added in v1.31.0
ForRunePosition returns the rune position of the chain.
func (*NodeChain) HasHeadType ¶ added in v1.31.0
HasHeadType returns true if the head node of the chain is of the given type.
type ObjectPrefixOption ¶ added in v1.29.0
type ObjectPrefixOption func(*config)
func AllowUnprefixedObjectType ¶ added in v1.29.0
func AllowUnprefixedObjectType() ObjectPrefixOption
func ObjectTypePrefix ¶ added in v1.29.0
func ObjectTypePrefix(prefix string) ObjectPrefixOption
func RequirePrefixedObjectType ¶ added in v1.29.0
func RequirePrefixedObjectType() ObjectPrefixOption
type Option ¶ added in v1.29.0
type Option func(*config)
func CaveatTypeSet ¶ added in v1.43.0
func CaveatTypeSet(cts *caveattypes.TypeSet) Option
func DisallowExpirationFlag ¶ added in v1.40.0
func DisallowExpirationFlag() Option
func SkipValidation ¶ added in v1.29.0
func SkipValidation() Option
type SchemaDefinition ¶ added in v1.14.0
SchemaDefinition represents an object or caveat definition in a schema.
type WithContextError ¶ added in v1.39.0
type WithContextError struct {
	BaseCompilerError
	SourceRange     input.SourceRange
	Source          input.Source
	ErrorSourceCode string
}
    WithContextError defines an error which contains contextual information.
func (WithContextError) DetailsMetadata ¶ added in v1.39.0
func (ewc WithContextError) DetailsMetadata() map[string]string
DetailsMetadata returns the metadata for details for this error.
func (WithContextError) Unwrap ¶ added in v1.39.0
func (ewc WithContextError) Unwrap() error