Skip to content

database/gdb: When using pbentity in issue scan, if cache is used, timestamppb.Time conversion will report an error #3641

Open
@yiqiang3344

Description

@yiqiang3344

Go version

go version go1.22.3 darwin/amd64

GoFrame version

v2.7.1

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

pbentity.Blog

message Blog {
    uint32                    Id       = 1   ; // Blog ID       
    string                    Title    = 2   ; // Title         
    string                    Content  = 3   ; // Content       
    string                    Nickname = 4   ; // Nickname      
    google.protobuf.Timestamp CreateAt = 5   ; // Created Time  
    google.protobuf.Timestamp UpdateAt = 6   ; // Updated Time  
    google.protobuf.Timestamp DeleteAt = 7   ; // Deleted Time  
}

program:

	var blog *pbentity.Blog
	err := dao.Blog.Ctx(ctx).Cache(gdb.CacheOption{
		Duration: time.Hour,
		Name:     "GetById",
		Force:    false,
	}).Where(do.Blog{
		Id: id,
	}).Scan(&blog)
	return blog, err

What did you see happen?

It is ok when not using cache, but an error will be reported when using cache:
reflect.Value.Convert: value of type *gvar.Var cannot be converted to type timestamppb.Timestamp

What did you expect to see?

The result of using cache should be the same as the result of not using cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIt is confirmed a bug, but don't worry, we'll handle it.enhancementhelp wantedplannedThis issue/proposal is planned into our next steps.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions