Documentation
¶
Index ¶
- Constants
- type Node
- type ResultFuncFactory
- type ResultFunction
- type ResultFunctionMeta
- type SchemaFuncFactory
- type SchemaFunction
- func NewChannel(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewDataCenter(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewDataCenterIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewDeviceCountry(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewDeviceCountryIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewEidAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewEidIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewFpdAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewGppSidAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewGppSidIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewPercent(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewRequestSchemaFunction(name string, params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewTcfInScope(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- func NewUserFpdAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
- type SchemaFunctionStep
- type Tree
Constants ¶
const ( Channel = "channel" DataCenter = "dataCenter" DataCenterIn = "dataCenterIn" DeviceCountry = "deviceCountry" DeviceCountryIn = "deviceCountryIn" EidAvailable = "eidAvailable" EidIn = "eidIn" FpdAvailable = "fpdAvailable" GppSidAvailable = "gppSidAvailable" GppSidIn = "gppSidIn" Percent = "percent" TcfInScope = "tcfInScope" UserFpdAvailable = "userFpdAvailable" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node[T1 any, T2 any] struct { SchemaFunction SchemaFunction[T1] ResultFunctions []ResultFunction[T1, T2] Children map[string]*Node[T1, T2] }
Node represents a node in the tree structure. It contains a schema function, a list of result functions, and a map of child nodes.
type ResultFuncFactory ¶
type ResultFuncFactory[T1 any, T2 any] func(string, json.RawMessage) (ResultFunction[T1, T2], error)
ResultFuncFactory is a function that takes a function name and arguments in JSON format and returns a ResultFunction and an error. It is used to create result functions for the tree nodes based on the provided configuration.
type ResultFunction ¶
type ResultFunction[T1 any, T2 any] interface { Call(payloadIn *T1, payloadOut *T2, meta ResultFunctionMeta) error Name() string }
type ResultFunctionMeta ¶
type ResultFunctionMeta struct {
SchemaFunctionResults []SchemaFunctionStep
AnalyticsKey string
RuleFired string
ModelVersion string
}
type SchemaFuncFactory ¶
type SchemaFuncFactory[T any] func(string, json.RawMessage) (SchemaFunction[T], error)
SchemaFuncFactory is a function that takes a function name and arguments in JSON format and returns a SchemaFunction and an error. It is used to create schema functions for the tree nodes based on the provided configuration.
type SchemaFunction ¶
SchemaFunction...
func NewChannel ¶
func NewChannel(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewDataCenter ¶
func NewDataCenter(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewDataCenterIn ¶
func NewDataCenterIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewDeviceCountry ¶
func NewDeviceCountry(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewDeviceCountryIn ¶
func NewDeviceCountryIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewEidAvailable ¶
func NewEidAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewEidIn ¶
func NewEidIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewFpdAvailable ¶
func NewFpdAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewGppSidAvailable ¶
func NewGppSidAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewGppSidIn ¶
func NewGppSidIn(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewPercent ¶
func NewPercent(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewRequestSchemaFunction ¶
func NewRequestSchemaFunction(name string, params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
NewRequestSchemaFunction returns the specified schema function that operates on a request payload along with any schema function args validation errors that occurred during instantiation
func NewTcfInScope ¶
func NewTcfInScope(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
func NewUserFpdAvailable ¶
func NewUserFpdAvailable(params json.RawMessage) (SchemaFunction[openrtb_ext.RequestWrapper], error)
type SchemaFunctionStep ¶
type Tree ¶
type Tree[T1 any, T2 any] struct { Root *Node[T1, T2] DefaultFunctions []ResultFunction[T1, T2] AnalyticsKey string ModelVersion string }
Tree represents the tree structure. It contains a root node and a list of default result functions. The tree is generic and can work with any types T1 and T2. The tree is used to traverse the nodes based on the schema function results and execute the result functions.
func NewTree ¶
NewTree builds a new tree using the provided tree builder function and validates the generated tree ensuring it is well-formed.
func (*Tree[T1, T2]) Run ¶
Run attempts to walk down the tree from the root to a leaf node. Each node references a schema function to execute that returns a result that is used to compare against the node values on the level below it. If the result matches one of the node values on the next level, we move to that node, otherwise we exit. If a leaf node is reached, it's result functions are executed on the provided result payload.