Skip to content

feature: export functions and remove internal package #461

Open
@switchupcb

Description

@switchupcb

How can you increase the library's usage and contributions?

Problem

You are limiting the library's usage and contributions by using an internal package and unexported functions.

dbgo uses a modified version of jet to interpret a Go file and output type-safe SQL.

Here are the issues experienced while implementing this functionality:

  1. Use of internal: Using jet programmatically with an interpreter requires you to use functions which reference internal, when functions in an internal package cannot be referenced. So, the developer must rename the entire internal package to use jet with an interpreter.
  2. Unexported functions
    1. genTemplate is unexported which requires the developer to inline a definition or export the function to use jet programmatically.
    2. postgres package contains unexported functions which requires the developer to export them when using jet with an interpreter.

Implementation

You can increase the library's usage and contributions by replacing the internal package and exporting certain unexported functions.

https://github.com/switchupcb/jet/tree/dbgo is a version of jet which has these problems fixed for PostgreSQL functionality.

Implementation: Internal Usage

The solution to this problem requires further discussion among maintainers.

Implementation: Export Unexported Functions

You can approve the decision to export unexported fuinctions required for usage of jet in an interpreter (e.g., functions in import "github.com/go-jet/jet/v2/postgres") and I can create a pull request to solve this problem.

Here are example commits:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions