Skip to content

Deserilization to type String #4

Open
@quijos12

Description

@quijos12

I have added the column 'created' to the table 'AppUser' in the example-postgresql

CREATE TABLE IF NOT EXISTS AppUser (
    id                      varchar (256) PRIMARY KEY,
    username                varchar (256) NOT NULL,
    email                   varchar (256) NOT NULL,
    password                varchar (256) NOT NULL,
    role                    varchar (256) NULL,
    created                 timestamp DEFAULT now(), -- NEW COLUMN --
    CONSTRAINT              UK_APPUSER_USERNAME UNIQUE (username),
    CONSTRAINT              UK_APPUSER_EMAIL UNIQUE (email)
);

I have modified 'UserDto.hpp' to add the field as String DTO_FIELD(String, created, "created");

but when I try to test the endpoint of getUserById to select some user, I get the following error

{
  "status": "ERROR",
  "code": 500,
  "message": "[oatpp::postgresql::mapping::Deserializer::deserializeString()]: Error. Unknown OID."
}

as I understand from the error message I have to perform a conversion type to take the timestamp value to string

How can I do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions