listAccounts command
This commit is contained in:
parent
be5cd05d08
commit
5e493554dc
6 changed files with 50 additions and 9 deletions
|
@ -11,6 +11,17 @@ import (
|
|||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
func GetAllAccounts(db *sqlx.DB) ([]model.Account, error) {
|
||||
var accounts = []model.Account{}
|
||||
|
||||
err := db.Select(&accounts, "SELECT * FROM account ORDER BY created_at ASC")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
func GetAccount(db *sqlx.DB, username string) (*model.Account, error) {
|
||||
var account = model.Account{}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue