listAccounts command

This commit is contained in:
ari melody 2025-01-20 19:11:16 +00:00
parent be5cd05d08
commit 5e493554dc
Signed by: ari
GPG key ID: CF99829C92678188
6 changed files with 50 additions and 9 deletions

View file

@ -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{}