github.com/openfga/openfga@v1.5.4-rc1/internal/condition/types/primitives.go (about)

     1  package types
     2  
     3  import (
     4  	"github.com/google/cel-go/cel"
     5  	openfgav1 "github.com/openfga/api/proto/openfga/v1"
     6  )
     7  
     8  const startingGenericTypeCount = 1
     9  
    10  var (
    11  	AnyParamType = registerParamType(
    12  		openfgav1.ConditionParamTypeRef_TYPE_NAME_ANY,
    13  		cel.AnyType,
    14  		anyTypeConverterFunc,
    15  	)
    16  	BoolParamType = registerParamType(
    17  		openfgav1.ConditionParamTypeRef_TYPE_NAME_BOOL,
    18  		cel.BoolType,
    19  		primitiveTypeConverterFunc[bool],
    20  	)
    21  	StringParamType = registerParamType(
    22  		openfgav1.ConditionParamTypeRef_TYPE_NAME_STRING,
    23  		cel.StringType,
    24  		primitiveTypeConverterFunc[string],
    25  	)
    26  	IntParamType = registerParamType(
    27  		openfgav1.ConditionParamTypeRef_TYPE_NAME_INT,
    28  		cel.IntType,
    29  		numericTypeConverterFunc[int64],
    30  	)
    31  	UIntParamType = registerParamType(
    32  		openfgav1.ConditionParamTypeRef_TYPE_NAME_UINT,
    33  		cel.UintType,
    34  		numericTypeConverterFunc[uint64],
    35  	)
    36  	DoubleParamType = registerParamType(
    37  		openfgav1.ConditionParamTypeRef_TYPE_NAME_DOUBLE,
    38  		cel.DoubleType,
    39  		numericTypeConverterFunc[float64],
    40  	)
    41  	DurationParamType = registerParamType(
    42  		openfgav1.ConditionParamTypeRef_TYPE_NAME_DURATION,
    43  		cel.DurationType,
    44  		durationTypeConverterFunc,
    45  	)
    46  	TimestampParamType = registerParamType(
    47  		openfgav1.ConditionParamTypeRef_TYPE_NAME_TIMESTAMP,
    48  		cel.TimestampType,
    49  		timestampTypeConverterFunc,
    50  	)
    51  	MapParamType = registerParamTypeWithGenerics(
    52  		openfgav1.ConditionParamTypeRef_TYPE_NAME_MAP,
    53  		startingGenericTypeCount,
    54  		mapTypeConverterFunc,
    55  	)
    56  	ListParamType = registerParamTypeWithGenerics(
    57  		openfgav1.ConditionParamTypeRef_TYPE_NAME_LIST,
    58  		startingGenericTypeCount,
    59  		listTypeConverterFunc,
    60  	)
    61  )