github.com/rajeev159/opa@v0.45.0/topdown/print/print.go (about)

     1  package print
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/open-policy-agent/opa/ast"
     7  )
     8  
     9  // Context provides the Hook implementation context about the print() call.
    10  type Context struct {
    11  	Context  context.Context // request context passed when query executed
    12  	Location *ast.Location   // location of print call
    13  }
    14  
    15  // Hook defines the interface that callers can implement to receive print
    16  // statement outputs. If the hook returns an error, it will be surfaced if
    17  // strict builtin error checking is enabled (otherwise, it will not halt
    18  // execution.)
    19  type Hook interface {
    20  	Print(Context, string) error
    21  }