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
The error is on Videotype: e.Videotype, line due to the mismatched types. Take a look at GroupVideosList
type GroupVideosList struct {
ID int "json:\"id\""
Title string "json:\"title\""
Videotype GroupVideosListVideotype "json:\"videotype\""
}
type GroupVideosListVideotype string
const (
GroupVideosListVideotypeLive GroupVideosListVideotype = "live"
GroupVideosListVideotypeVideo GroupVideosListVideotype = "video"
GroupVideosListVideotypePlaylist GroupVideosListVideotype = "playlist"
)
and ent.Video
type Video struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// Title holds the value of the "title" field.
Title string `json:"title,omitempty"`
// Videotype holds the value of the "videotype" field.
Videotype video.Videotype `json:"videotype,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the VideoQuery when eager-loading is set.
Edges VideoEdges `json:"edges"`
group_videos *int
}
// Videotype defines the type for the "videotype" enum field.
type Videotype string
// Videotype values.
const (
VideotypeLive Videotype = "live"
VideotypeVideo Videotype = "video"
VideotypePlaylist Videotype = "playlist"
)
The error is happeing due to not doing explicit typecasting and can be solved by Videotype: GroupVideosListVideotype(e.Videotype),
func (h *OgentHandler) CreateVideo(ctx context.Context, req CreateVideoReq) (CreateVideoRes, error) {
b := h.client.Video.Create()
// Add all fields.
b.SetTitle(req.Title)
b.SetVideotype(req.Videotype)
}
also here
func (h *OgentHandler) UpdateVideo(ctx context.Context, req UpdateVideoReq, params UpdateVideoParams) (UpdateVideoRes, error) {
b := h.client.Video.UpdateOneID(params.ID)
// Add all fields.
if v, ok := req.Title.Get(); ok {
b.SetTitle(v)
}
if v, ok := req.Videotype.Get(); ok {
b.SetVideotype(v)
}
Thanks.
The text was updated successfully, but these errors were encountered:
When I try to use Ogent with Enum , I am getting Errors.
I have hosted an example at https://github.com/chasak/enumeg
Here is part of schema file.
This generates the following response
The error is on
Videotype: e.Videotype,
line due to the mismatched types. Take a look atGroupVideosList
and
ent.Video
The error is happeing due to not doing explicit typecasting and can be solved by
Videotype: GroupVideosListVideotype(e.Videotype),
Same Issue with handler Function
also here
Thanks.
The text was updated successfully, but these errors were encountered: