Skip to content

SQLC doesn't support GEOMETRY type in MYSQL #3741

Open
@AlirezaMZV2000

Description

@AlirezaMZV2000

Version

1.27.0

What happened?

GEOMETRY is a type defined in MySQL, used for keeping and querying Spatial Data. But SQLC doesn't support this type and raises a syntax error when I try to generate Golang codes from my Database Schema.
I even tried to override the column with this type with some other known type but it didn't work either again because SQLC doesn't recognize GEOMETRY type.

Is there any quick solution for this?

Relevant log output

syntax error near "GEOMETRY NOT NULL"

Database schema

CREATE TABLE  geometries (
    id INT AUTO_INCREMENT PRIMARY KEY,
    coordinates GEOMETRY NOT NULL
);

Configuration

version: "2"
sql:
  - engine: mysql
    schema: ../../../../../db/masterdata
    queries: ../../../../../db/masterdata_queries.sql
    gen:
      go:
        package: models
        sql_package: "database/sql"
        sql_driver: "github.com/go-sql-driver/mysql"
        out: models
        overrides:
          - column: "geometries.coordinates"
            go_type: "[]bytes"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions