Skip to content

Golang support #9

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

Closed
php-coder opened this issue Jul 26, 2020 · 2 comments
Closed

Golang support #9

php-coder opened this issue Jul 26, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request lang/golang
Milestone

Comments

@php-coder
Copy link
Owner

No description provided.

@php-coder php-coder added the enhancement New feature or request label Jul 26, 2020
@php-coder php-coder self-assigned this Jul 26, 2020
@php-coder php-coder added this to the 0.0.3 milestone Jul 26, 2020
php-coder added a commit that referenced this issue Jul 28, 2020
At this moment it defaults to "js" and everything works as before. But if you pass --lang go it
won't generate JS-related files.

Part of #9
php-coder added a commit that referenced this issue Jul 29, 2020
php-coder added a commit that referenced this issue Aug 4, 2020
php-coder added a commit that referenced this issue Aug 13, 2020
php-coder added a commit that referenced this issue Aug 13, 2020
@php-coder
Copy link
Owner Author

php-coder commented Aug 13, 2020

Decision: use go-chi/chi for routing (see #12)
Decision: use go-chi/render for JSON rendering let's use json encoder/decoder from standard library
Decision: use main as a module name in go.mod. Later, we can make it configurable
Decision: use go 1.14 in go.mod. Later, we can make it configurable

php-coder added a commit that referenced this issue Aug 13, 2020
php-coder added a commit that referenced this issue Aug 15, 2020
php-coder added a commit that referenced this issue Aug 22, 2020
php-coder added a commit that referenced this issue Aug 24, 2020
BREAKING CHANGE:

Old syntax:
- path: /v1/categories/count
  get:  select count(*) as counter from categories

New syntax:
- path: /v1/categories/count
  get:
    query: select count(*) as counter from categories

The new syntax is needed for upcoming support of DTO objects.

This change also restructures internal representation in order to simplify code.

Part of #9
php-coder added a commit that referenced this issue Aug 26, 2020
…list

Add dependency on jmoiron/sqlx for named parameters support (and to simplify result extraction into
structs). See for details:
go-sql-driver/mysql#561 (comment)

See also:
- http://go-database-sql.org
- https://github.com/jmoiron/sqlx
- http://jmoiron.github.io/sqlx/

Part of #9
php-coder added a commit that referenced this issue Aug 26, 2020
For example, for the following mapping:

- path: /v1/categories/count
  get:
    query: SELECT COUNT(*) AS counter FROM categories
    dto:
      name: CounterDto

the generated struct will be named "CounterDto" instead of "Dto<N>".

Part of #9
php-coder added a commit that referenced this issue Aug 28, 2020
php-coder added a commit that referenced this issue Aug 28, 2020
By default, string type is used. Also, the value is optional (nullable).

Example of specifying an integer type:
dto:
  fields:
    counter:
      type: integer

Part of #9
php-coder added a commit that referenced this issue Aug 29, 2020
php-coder added a commit that referenced this issue Aug 30, 2020
php-coder added a commit that referenced this issue Aug 30, 2020
php-coder added a commit that referenced this issue Aug 30, 2020
php-coder added a commit that referenced this issue Aug 30, 2020
php-coder added a commit that referenced this issue Aug 30, 2020
@php-coder php-coder changed the title Golang support [go] Golang support Oct 13, 2022
@php-coder php-coder changed the title [go] Golang support Golang support Mar 13, 2024
php-coder added a commit that referenced this issue Mar 28, 2024
…matches input type

The error was:
NamedExec failed: Error 1366: Incorrect integer value: '' for column 'created_by' at row 1

Relate to #9
Relate to #13
php-coder added a commit that referenced this issue Mar 28, 2024
The error was:
Select failed: scannable dest type slice with >1 columns (4) in result

Relate to #9
Relate to #13
php-coder added a commit that referenced this issue Mar 28, 2024
@php-coder
Copy link
Owner Author

At least all CRUD methods are implemented, so I think it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lang/golang
Projects
None yet
Development

No branches or pull requests

1 participant