github.com/MontFerret/ferret@v0.18.0/pkg/runtime/expressions/literals/boolean.go (about)

     1  package literals
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/MontFerret/ferret/pkg/runtime/core"
     7  	"github.com/MontFerret/ferret/pkg/runtime/values"
     8  )
     9  
    10  type BooleanLiteral bool
    11  
    12  func NewBooleanLiteral(val bool) BooleanLiteral {
    13  	return BooleanLiteral(val)
    14  }
    15  
    16  func (l BooleanLiteral) Exec(_ context.Context, _ *core.Scope) (core.Value, error) {
    17  	if l {
    18  		return values.True, nil
    19  	}
    20  
    21  	return values.False, nil
    22  }