ft5 table creation

This commit is contained in:
Simon Martens
2025-02-16 03:05:44 +01:00
parent 2d9e27ac8e
commit ca1c7272b6
4 changed files with 174 additions and 1 deletions

View File

@@ -97,3 +97,19 @@ func GetFields(records []*core.Record, field string) []any {
}
return fields
}
func CreateFTS5TableQuery(tablename string, fields ...string) string {
if len(fields) == 0 {
return ""
}
str := "CREATE VIRTUAL TABLE IF NOT EXISTS " + FTS5_PREFIX + tablename + " USING fts5(id, "
for i, f := range fields {
str += f
if i < len(fields)-1 {
str += ", "
}
}
str += ")"
return str
}