- 
                Notifications
    You must be signed in to change notification settings 
- Fork 962
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
When working with structs, struct tags are used to add additional information to a field. This is for example very common when using validation packages. But currently there is no way to add additional struct tags to take advantage of this.
I think it would be a great idea to add a comment syntax just like the -- name:NameForQuery for table columns.
A possible option to express these custom struct tags would be to write create table statements like this:
CREATE TABLE user (
  id   BIGSERIAL PRIMARY KEY,
  -- tags:`validate:"min=10,max=0"`
  username text NOT NULL,
  -- tags:`validate:"gt=18"`
  age  integer NOT NULL,
  -- tags:`validate:"url"`
  website text NOT NULL
);or alternatively:
CREATE TABLE user (
  id   BIGSERIAL PRIMARY KEY,
  username text NOT NULL,     -- tags:`validate:"min=10,max=0"`
  age integer NOT NULL,       -- tags:`validate:"gt=18"`
  website text NOT NULL       -- tags:`validate:"url"`
);tooolbox, denisdubovitskiy, huangc28, qkniep, yxy and 14 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request