github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/caveats/source.go (about) 1 package caveats 2 3 import ( 4 "github.com/authzed/cel-go/common" 5 ) 6 7 // SourcePosition is an incoming source position. 8 type SourcePosition interface { 9 // LineAndColumn returns the 0-indexed line number and column position in the source file. 10 LineAndColumn() (int, int, error) 11 12 // RunePosition returns the 0-indexed rune position in the source file. 13 RunePosition() (int, error) 14 } 15 16 // NewSource creates a new source for compilation into a caveat. 17 func NewSource(expressionString string, name string) (common.Source, error) { 18 return common.NewStringSource(expressionString, name), nil 19 }