arp242 / uni

Query the Unicode database from the commandline, with good support for emojis
MIT License
790 stars 19 forks source link

Use embeded SQLite? #23

Closed arp242 closed 3 years ago

arp242 commented 3 years ago

Just a random idea I'll jot down: what if instead of using Go structs in unidata for all the codepoints etc. we would use a SQLite database compiled in the binary?

This would be more structured, easier to reuse, and most of all: easy to query. While the current CLI is convenient, sometimes you want to know things like "which characters are full-width"?

Need to look at the feasibility of this, and how it will affect performance, binary size, etc. Also SQLite requires cgo which makes the builds a bit harder, but this may be a nice use case for e.g. https://modernc.org/sqlite

skuzzymiglet commented 3 years ago

modernc's package (sqlite too probably) would hurt performance a bit (and add complexity). For complex queries, maybe expr would do the job (haven't used it but I am planning on integrating it into my own project)

I wouldn't see an issue with generating an SQLite DB of characters alongside the Go structs, if you want SQL

arp242 commented 3 years ago

I don't know what the performance impact would be exactly – I'd imagine it's not necessarily too bad, but it requires some patches to allow the Go SQLite driver read the database from memory. it's just a random idea I had and I wrote it down in case I'm bored and looking for things to do 🙃 Maybe I'll never look at it...