feature 'deleted' not work properly with join? #1512

Closed
opened 2020-01-17 09:45:23 +00:00 by sesky42 · 2 comments
type User struct{
	Id		 int
	DeleteAt time.Time `xorm:"deleted"`
}

type Group struct{
	Id int
}

type UserGroup struct{
	User	`xorm:"extends"`
    Group	`xorm:"extends"`
}

func (ug UserGroup) TableName() string{
	return "group" // it cause xorm generate sql like SELECT ...WHERE `group`.`delete_at` IS NOT NULL....
}

Because

func (table *Table) DeletedColumn() *Column {
	return table.GetColumn(table.Deleted)
}

I don't know whether it should be a bug or not.
But it really confused me for sometime.

``` type User struct{ Id int DeleteAt time.Time `xorm:"deleted"` } type Group struct{ Id int } type UserGroup struct{ User `xorm:"extends"` Group `xorm:"extends"` } func (ug UserGroup) TableName() string{ return "group" // it cause xorm generate sql like SELECT ...WHERE `group`.`delete_at` IS NOT NULL.... } ``` Because ``` func (table *Table) DeletedColumn() *Column { return table.GetColumn(table.Deleted) } ``` I don't know whether it should be a bug or not. But it really confused me for sometime.
Owner

When you use extends all parent structs' fields wil be considered as current table's columns.

When you use `extends` all parent structs' fields wil be considered as current table's columns.
lunny added the
need
feedback
label 2020-01-20 15:43:52 +00:00
lunny added
kind
bug
and removed
need
feedback
labels 2020-03-03 13:03:53 +00:00
lunny removed the
kind
bug
label 2020-03-03 13:05:33 +00:00
Owner

I think this is not a bug.

I think this is not a bug.
lunny closed this issue 2020-03-03 13:05:48 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1512
No description provided.