Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing destination name scene_type in *[]*model.Resource #939

Open
linxiang4200 opened this issue Aug 23, 2024 · 0 comments
Open

missing destination name scene_type in *[]*model.Resource #939

linxiang4200 opened this issue Aug 23, 2024 · 0 comments

Comments

@linxiang4200
Copy link

Issue description

I have a table named resource and have defined a struct for it. However, I now need to add a new field to the table, but when this field is not yet added to the struct definition in the code, running the code results in an error: "missing destination name scene_type in *[]*model.Resource." ,even though I didn't use this field .
How can I avoid this error? Since database changes and code changes are not deployed simultaneously, this could cause issues when the service goes live.

Example code

type Resource struct {
	Id            int          `db:"id" json:"id"`
	CompanyId     int          `db:"company_id" json:"companyId"`
	Pid           int          `db:"pid" json:"pid"`
	CreatorId     int          `db:"creator_id" json:"creatorId"`
	Size          int64        `db:"size" json:"size"`
	Width         int          `db:"width" json:"width"`
	Height        int          `db:"height" json:"height"`
	IsFolder      bool         `db:"is_folder" json:"isFolder"`
	Trashed       bool         `db:"trashed" json:"trashed"`
	Type          ResourceType `db:"type" json:"type"`
	Filename      string       `db:"filename" json:"filename"`
	Extension     string       `db:"extension" json:"extension"`
	Thumbnail     string       `db:"thumbnail" json:"thumbnail"`
	// SceneType     int          `db:"scene_type" json:"sceneType"`   //if I not add this it will be error,even though I didn't use this field 

}

Error log

missing destination name scene_type in *[]*model.Resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant