remove slice pointers

This commit is contained in:
dhax 2017-10-30 00:00:20 +01:00
parent 543b39f822
commit a774338ccd
3 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,7 @@ var (
// AccountStore defines database operations for account management.
type AccountStore interface {
List(f auth.AccountFilter) (*[]auth.Account, int, error)
List(f auth.AccountFilter) ([]auth.Account, int, error)
Create(*auth.Account) error
Get(id int) (*auth.Account, error)
Update(*auth.Account) error
@ -87,11 +87,11 @@ func newAccountResponse(a *auth.Account) *accountResponse {
}
type accountListResponse struct {
Accounts *[]auth.Account `json:"accounts"`
Accounts []auth.Account `json:"accounts"`
Count int `json:"count"`
}
func newAccountListResponse(a *[]auth.Account, count int) *accountListResponse {
func newAccountListResponse(a []auth.Account, count int) *accountListResponse {
resp := &accountListResponse{
Accounts: a,
Count: count,

View file

@ -23,7 +23,7 @@ type Account struct {
Active bool `sql:",notnull" json:"active"`
Roles []string `pg:",array" json:"roles,omitempty"`
Token []*Token `json:"token,omitempty"`
Token []Token `json:"token,omitempty"`
}
// BeforeInsert hook executed before database insert operation.

View file

@ -26,7 +26,7 @@ func NewAdmAccountStore(db *pg.DB) *AdmAccountStore {
}
// List applies a filter and returns paginated array of matching results and total count.
func (s *AdmAccountStore) List(f auth.AccountFilter) (*[]auth.Account, int, error) {
func (s *AdmAccountStore) List(f auth.AccountFilter) ([]auth.Account, int, error) {
a := []auth.Account{}
count, err := s.db.Model(&a).
Apply(f.Filter).
@ -34,7 +34,7 @@ func (s *AdmAccountStore) List(f auth.AccountFilter) (*[]auth.Account, int, erro
if err != nil {
return nil, 0, err
}
return &a, count, nil
return a, count, nil
}
// Create creates a new account.