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

Required callback after fetching rows #35

Closed
souravray opened this issue Dec 29, 2013 · 2 comments
Closed

Required callback after fetching rows #35

souravray opened this issue Dec 29, 2013 · 2 comments

Comments

@souravray
Copy link

I need to use diffrent date-time format for database and application. I have following struc for model

type SomeTable struct {
Id int64
SomeString string sql:"size:255"
SomeDate time.Time
}

I'm converting the the date format before saving by

func (o *SomeTable ) BeforeSave() (err error) {
o.SomeDate = o.SomeDate.Format(SQL_DATE_FORMAT)
return
}

but the problem is when I'm facing in when fetching data from data base. I am looking for an AfterGet method to transform the data (similar to PostGet in gorp). Can you suggest any other workaround?

@jinzhu
Copy link
Member

jinzhu commented Dec 30, 2013

Hi @souravray

Already added AfterFind support, please check it out. jinzhu@dd77ca6

Thank you.

@jinzhu jinzhu closed this as completed Dec 30, 2013
@souravray
Copy link
Author

thanks jinzhu

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

2 participants