jwt validation, getting the correct database
This commit is contained in:
@ -40,8 +40,8 @@ func AddContact(m *Contact) (id int64, err error) {
|
||||
|
||||
// GetContactById retrieves Contact by Id. Returns error if
|
||||
// Id doesn't exist
|
||||
func GetContactById(id int) (v *Contact, err error) {
|
||||
o := orm.NewOrm()
|
||||
func GetContactById(o orm.Ormer, id int) (v *Contact, err error) {
|
||||
//o := orm.NewOrm()
|
||||
v = &Contact{Id: id}
|
||||
if err = o.Read(v); err == nil {
|
||||
return v, nil
|
||||
@ -51,9 +51,8 @@ func GetContactById(id int) (v *Contact, err error) {
|
||||
|
||||
// GetAllContact retrieves all Contact matches certain condition. Returns empty list if
|
||||
// no records exist
|
||||
func GetAllContact(query map[string]string, fields []string, sortby []string, order []string,
|
||||
func GetAllContact(o orm.Ormer, query map[string]string, fields []string, sortby []string, order []string,
|
||||
offset int64, limit int64) (ml []interface{}, err error) {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(new(Contact))
|
||||
// query k=v
|
||||
for k, v := range query {
|
||||
|
Reference in New Issue
Block a user