mirror of
https://github.com/VinGarcia/ksql.git
synced 2025-09-04 19:36:56 +00:00
Updated Modifiers (markdown)
parent
cff5d181aa
commit
8117b95faa
14
Modifiers.md
14
Modifiers.md
@ -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.
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user