edgedb/edgedb-go

Can't decode datetime into `edgedb.OptionalDateTime`

fmoor opened this issue · 3 comments

fmoor commented

originally reported on discord

Reproduction

abstract type Content {
    required property created -> datetime {
        default := datetime_of_statement();
        readonly := true;
    };
    required property updated -> datetime {
        default := datetime_of_statement();
    };
    required link creator -> User;
    link deletion -> DeletionEvent;
}
type ConcreteContent struct {
// bunch of other fields
    ID             edgedb.UUID           `edgedb:"id"`
    Created        edgedb.OptionalDateTime `edgedb:"created"`
    Updated        edgedb.OptionalDateTime `edgedb:"updated"`
// followed by more fields
}
id, _ := edgedb.ParseUUID(incoming.ID)
concreteInstance := Concrete{ID: id}
query := `select Concrete {
       otherConcreteType: {
        id,
        title,
        updated
       },
    } filter .id = <uuid>$0`
err := s.Conn.QuerySingle(ctx, query, &concreteInstance, concreteInstance.ID)
if err != nil {
    return OtherConcreteType{}, err
}
otherConcreteInstance := concreteInstance.otherConcreteType
return otherConcreteInstance, nil

Actual behavior
edgedb.OptionalDateTime values are not set.

Expected behavior
edgedb.OptionalDateTime should handle non optional values.

fmoor commented

I wasn't able to reproduce this. I asked for a minimal reproduction from the user reporting the issue on discord.

Hi, I'm the user who reported it. The issue ended up being with my query. This issue can be closed. Thanks for your help.

fmoor commented

Sounds good. Thanks @TomLisankie!