You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using PostgreSQL and in my table I have the primary key like
CREATETABLEIF NOT EXISTS users (
id UUID NOT NULLPRIMARY KEY DEFAULT UUID_GENERATE_V4(),
name VARCHAR(320) NOT NULL
);
CREATEINDEXON users (email);
Which means that INSERT INTO users (name) VALUES ("Bob"); will work, and postgresql will generate a UUID in the id column.
I'm trying to do the same with modl, but as the field id is empty in my struct, apparently modl is filling with an empty string ("") and pg complains that's not a valid uuid type.
I'm using PostgreSQL and in my table I have the primary key like
Which means that
INSERT INTO users (name) VALUES ("Bob");
will work, and postgresql will generate a UUID in the id column.I'm trying to do the same with modl, but as the field id is empty in my struct, apparently modl is filling with an empty string (
""
) and pg complains that's not a valid uuid type.I this panic
PANIC: pq: invalid input syntax for uuid: ""
How can I achieve this ? I tried using
db:"-"
in theId
field, and that worked for the insert, but that makes it harder to use the same struct after.The text was updated successfully, but these errors were encountered: