Skip to content

Commit

Permalink
Merge pull request #4 from adrianpozueco/sybaseClient
Browse files Browse the repository at this point in the history
SyBaseClient: add method to return map[string]interface{}
  • Loading branch information
adrianpozueco authored Jun 29, 2021
2 parents 0a9a7bc + c1d5d30 commit c68eb6d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sybase/sybaseClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (c *SyBaseClient) moveToSchema(db *sql.DB) error {
return err
}

//TODO(pozuecoa): deprecate
func (c *SyBaseClient) Query(sql string) (*sql.Rows, error) {
db := c.getDB()
if err := c.moveToSchema(db); err != nil {
Expand All @@ -39,3 +40,16 @@ func (c *SyBaseClient) Query(sql string) (*sql.Rows, error) {
defer db.Close()
return db.Query(sql)
}

func (c *SyBaseClient) QueryMap(sql string) ([]map[string]interface{}, error) {
rows, err := c.Query(sql)
if err != nil {
return nil, err
}

if err := rows.Err(); err != nil {
return nil, err
}

return ToMap(rows)
}

0 comments on commit c68eb6d

Please sign in to comment.