Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLC doesn't support GEOMETRY type in MYSQL #3741

Open
AlirezaMZV2000 opened this issue Dec 12, 2024 · 0 comments
Open

SQLC doesn't support GEOMETRY type in MYSQL #3741

AlirezaMZV2000 opened this issue Dec 12, 2024 · 0 comments

Comments

@AlirezaMZV2000
Copy link

AlirezaMZV2000 commented Dec 12, 2024

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant