Does this package support eponymous-only virtual tables? I see some vtable related files that have the sqlite_vtable and vtable build tags, but I can't tell if they would allow a NULL xCreate.
Did you try to build with -tags sqlite_vtable ?
It doesn't support them. This repo hard-codes xCreate to a function that ultimately calls the Create method on the Module interface implementation. Consequently, there is no mechanism at present to cause it to be null.
Thank you @rittneje
Thank you @rittneje for providing context, coming across this issue when searching around for eponymous virtual table in this library and this is very helpful. Based on the current implementation, do you think it would be possible to implement a means of passing a null as the xCreate method? Unfortunately, I don't have much experience with c/cgo, but would love to experiment (ideally with some guidance!) to try adding support for eponymous virtual tables in this package. The current virtual table implementation is really cool and has been doing quite a bit of heavy lifting in a project I've been building!
One option I can think of is to add an optional interface. Something like:
type EponymousOnlyModule interface {
Module
EponymousOnlyModule()
}
Then you could say that if the module implements EponymousOnlyModule(), then xCreate should be null and the Create method is ignored. Regular modules will not define the EponymousOnlyModule() method at all.
In terms of the sqlite3_module object, the simplest approach is to copy the goModule object (except set xCreate to null), and then choose one or the other in CreateModule.
@rittneje FYI #885 attempts to implement what you suggested above - would love any feedback if you're available! Thanks again for the help!
Most helpful comment
@rittneje FYI #885 attempts to implement what you suggested above - would love any feedback if you're available! Thanks again for the help!