Right now, when it's required to connect to sqld with an auth token, the SDK requires that it appear in the URL passed to Open. This isn't the most clean approach, probably only works with the Go SDK, and places additional stress on the formal definition of a libsql URL. Ideally we should find another way to specify the token as a separate item of data, like we do in the other libsql SDKs.
@honzasp points out that the docs for database/sql mentions in the doc for Open that:
Most users will open a database via a driver-specific connection helper function that returns a *DB.
So perhaps we should provide this helper when the developer needs an auth token (but Open alone is fine when doing local development). It looks like OpenDB can take a custom Connector. If we do this, I think auth token support in the URL should become deprecated and eventually removed.
Right now, when it's required to connect to sqld with an auth token, the SDK requires that it appear in the URL passed to Open. This isn't the most clean approach, probably only works with the Go SDK, and places additional stress on the formal definition of a libsql URL. Ideally we should find another way to specify the token as a separate item of data, like we do in the other libsql SDKs.
@honzasp points out that the docs for database/sql mentions in the doc for
Open
that:So perhaps we should provide this helper when the developer needs an auth token (but
Open
alone is fine when doing local development). It looks likeOpenDB
can take a customConnector
. If we do this, I think auth token support in the URL should become deprecated and eventually removed.