go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Add Inline Documentation for adding Custom Extension Functions in `sqlite3-binding.c`

Open jeffreyaven opened this issue 1 year ago • 0 comments

Background

We are using mattn/go-sqlite3 in stackql/stackql; we need to add custom extension functions specific to our program. We wouldn't expect these to be committed to this project, but we want an easy, repeatable, automated method to add our functions in a fork via a make target (like make amalgamate). We believe other developers would benefit from this capability as well.

Proposal

Inline documentation is proposed to facilitate developers' addition of custom extension functions. My approach would be to add comments within the sqlite3-binding.c file that serve as placeholders for adding custom extension functions. This would help external developers understand where to include their extension functions without requiring the maintainers of matte/go-sqlite3 to verify, test, or maintain those external functions.

Proposed Changes

1. Forward Declarations

// CUSTOM_EXTENSIONS
// 1.  Add custom extension initializer function declarations here...
// End CUSTOM_EXTENSIONS

2. Extension Initializer Array

// CUSTOM_EXTENSIONS
// 2.  Include custom extension initializer functions here...
// End CUSTOM_EXTENSIONS

3. Extension Initializer Functions

// CUSTOM_EXTENSIONS
// 3.  Add custom extension initializer functions here...
// End CUSTOM_EXTENSIONS

Benefit

These comments will provide clear guidance to developers looking to add custom extensions, helping them to understand the appropriate sections in the sqlite3-binding.c file where they should include their code.

Request

I would like to open a pull request to add these comments and would appreciate any feedback or suggestions.

jeffreyaven avatar Aug 06 '24 05:08 jeffreyaven