Skip to content

Conversation

@jberkel
Copy link
Collaborator

@jberkel jberkel commented May 22, 2016

This PR adds support for setting all available parameters for FTS4 with a fluent builder-style interface, #164.

Bonus: Support for FTS5 which differs in a lot of ways from FTS4 but also shares a few config options.

However most users won't need this bit so it might make sense to compile it in conditionally? OTOH it's not a lot of extra code, and pulling in a FTS5-enabled version of SQLite is fairly straightforward now (with CocoaPods / #431).

@stephencelis
Copy link
Owner

This is really cool! And makes me want to revisit the CREATE TABLE builder for a chained pattern like this.

One consideration I've had for column() options is to use an options set instead of named parameters (since a lot of them are just true or not). Any thoughts on moving that direction? E.g., with your builder pattern applied to the current table builder:

try db.run(users.create()
    .column(id, [.primaryKey])
    .column(name)
    .column(email, [.unique]))

@jberkel
Copy link
Collaborator Author

jberkel commented May 26, 2016

Good point, that should also simplify the method signatures quite significantly. TableBuilder has currently almost 40 declared public methods.

let body = Expression<String>("body")
let config = FTS5Config()
.column(subject)
.column(body, indexed: false)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spirit of my previous comment, what do you think of updating this to be:

    .column(body, [.unindexed])

@stephencelis stephencelis merged commit c36ef12 into stephencelis:master May 30, 2016
@stephencelis
Copy link
Owner

This is great, thanks again!

@jberkel jberkel deleted the fts-config branch May 30, 2016 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants