Does it support on two scene in postgres? So if have column xxx, i get xxx.if not, i get the default value(string is "", int is zero and so on).Because I'm not sure if the column exists(such as code upgrade but database not). #1981
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1981
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For example:
type User struct {
Name string
json:"name"
Age int
json:"age,omitempty"
}
i get data from postgres and database User have column name but not age, but i can set tag to ignore it, so i still get user data.
thanks!
Use
-
just likejson
tag.but if database User have column Age, it will not return.
Does it support on two scene? if have column Age, i get name and age.if not, i get name only.
It has been supported. If results have no column
age
, it will not be assigned a value. it will be zero.yes,because the default value of int type is zero in golang.but if use
Name string
xorm:"-"
if have column Name, i can't get name.
Does it support ignore param when column does not exist in postgres?to Does it support on two scene in postgres? if have column xxx, i get xxx.if not, i get the default value(string is "", int is zero and so on).Does it support on two scene in postgres? if have column xxx, i get xxx.if not, i get the default value(string is "", int is zero and so on).to Does it support on two scene in postgres? So if have column xxx, i get xxx.if not, i get the default value(string is "", int is zero and so on).Because I'm not sure if the column exists(such as code upgrade but database not).When you use
Get
, the first return parameter will tell you if the record exist. And you can also create the struct with default fields values. So that if the record is not exist on database, the value will not be changed.I will not support that in xorm.