I am referring to the README.md, and I have created a sample program to read and write from threaddb.
I also want to test out WriteValidator and ReadFilter. But ReadFilter is not working for me. I tried to use following snippet as defined in README.md.
err := db.NewCollection(context.Background(), myThreadID, db.CollectionConfig{
Name: "Persons",
Schema: mySchema,
Indexes: []db.Index{{
Path: "name",
Unique: true,
}},
WriteValidator:
var type = event.patch.type
var patch = event.patch.json_patch
switch (type) {
case "delete":
if (writer != "the_boss") {
return false // Not the boss? No deletes for you.
}
default:
return true
}
,
ReadFilter:
if (instance.Age > 50) {
delete instance.Age // Getting old, let's hide just _how_ old hehe
}
return instance
,
})
Hi Team,
I am referring to the README.md, and I have created a sample program to read and write from threaddb. I also want to test out WriteValidator and ReadFilter. But ReadFilter is not working for me. I tried to use following snippet as defined in README.md.
Please help me here. What am I doing wrong?