Updated Modifiers (markdown)

Vinícius Garcia 2022-12-11 18:12:30 -03:00
parent cff5d181aa
commit 8117b95faa

@ -60,16 +60,22 @@ Registering a new Modifier is simple: Describe it using an instance of `ksqlmodi
```golang ```golang
func init() { func init() {
ksqlmodifiers.RegisterAttrModifier("my_modifier_name", ksqlmodifiers.AttrModifier{ ksqlmodifiers.RegisterAttrModifier("my_modifier_name", ksqlmodifiers.AttrModifier{
SkipInserts: false, // set it to true if you want this modifier to cause the field to be ignored on inserts. // Set SkipInserts to true if you want this modifier to
// cause the field to be ignored on inserts.
SkipInserts: false,
SkipUpdates: false, // set it to true if you want this modifier to cause the field to be ignored on updates. // Set SkipUpdates to true if you want this modifier to
// cause the field to be ignored on updates.
SkipUpdates: false,
Scan: func(ctx context.Context, opInfo ksqlmodifiers.OpInfo, attrPtr interface{}, dbValue interface{}) error { Scan: func(ctx context.Context, opInfo ksqlmodifiers.OpInfo, attrPtr interface{}, dbValue interface{}) error {
// Read the dbValue, modify it and then save it into the attrPtr argument using reflection. // Read the dbValue, modify it and then save it
// into the attrPtr argument using reflection if necessary.
}, },
Value: func(ctx context.Context, opInfo ksqlmodifiers.OpInfo, inputValue interface{}) (outputValue interface{}, _ error) { Value: func(ctx context.Context, opInfo ksqlmodifiers.OpInfo, inputValue interface{}) (outputValue interface{}, _ error) {
// Read the inputValue, modify it and then return it so the database can save it. // Read the inputValue, modify it and then
// return it so the database can save it.
}, },
}) })
} }