Skip to content

Trouble getting emit_pointers_for_null_types to apply to SQLite target #3167

Closed
@ddowl

Description

@ddowl

Version

1.24.0

What happened?

I'm having some trouble getting the emit_pointers_for_null_types option to apply to a SQLite schema & queries, i.e. sql.Null* types aren't replaced with their pointer primitive variants. I've checked that other kinds of Go options work correctly, like emit_result_struct_pointers, emit_interface, and emit_json_tags, but not the null type option. I produced a minimal example that reproduces my issue in this playground link. Not sure if this is a SQLite specific issue, since we have a similar Postgres schema where emit_pointers_for_null_types works fine.

Relevant log output

No response

Database schema

CREATE TABLE dummy (
  "id" text NOT NULL PRIMARY KEY,
  "col_1" text
);

SQL queries

-- name: GetDummy :one
SELECT * FROM dummy WHERE id = ?1;

-- name: GetDummies :many
SELECT * FROM dummy;

-- name: CreateDummy :one
INSERT INTO dummy (id, col_1) VALUES (?1, ?2)
RETURNING *;

-- name: UpdateDummy :one
UPDATE dummy SET col_1 = ?2 WHERE id = ?1
RETURNING *;

-- name: DeleteDummy :exec
DELETE FROM dummy WHERE id = ?1;

Configuration

version: "2"
sql:
- schema: "schema.sql"
  queries: "query.sql"
  engine: "sqlite"
  gen:
    go:
      package: "sqlc"
      out: "./"
      emit_pointers_for_null_types: true

Playground URL

https://play.sqlc.dev/p/3d5b8939ebe833a68c11808b30ed27c0907bd2cbaf9422951775e7de6349e949

What operating system are you using?

macOS

What database engines are you using?

SQLite

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions