Your Question

Right now when use gorm to join table it should be looks like this:

db.Model(&Users{}).
    Joins("user_avatar ON user_avatar.user_id=users.id").
    Find(&recordList)

Is there a way to join table with alias like this:

db.Model(&Users{}, "table_alias_a").
    LeftJoin(&UserAvatar{}, "table_alias_b", "ON table_alias_b.user_id=table_alias_a.id").
    Find(&recordList)

Code above avoided table name to be hard coded.