User model fixed and flags logic now working
This commit is contained in:
parent
fd3ccc753e
commit
504363799e
2 changed files with 9 additions and 9 deletions
|
@ -101,17 +101,17 @@ func composeListUserOutput(user paneldb.User, usernameFlag, emailFlag, dateCreat
|
|||
var row string
|
||||
if usernameFlag {
|
||||
row += user.UserName
|
||||
if emailFlag || !dateCreatedFlag {
|
||||
if emailFlag || dateCreatedFlag {
|
||||
row += "\t"
|
||||
}
|
||||
}
|
||||
if emailFlag {
|
||||
row += user.Email
|
||||
if !dateCreatedFlag {
|
||||
if dateCreatedFlag {
|
||||
row += "\t"
|
||||
}
|
||||
}
|
||||
if !dateCreatedFlag {
|
||||
if dateCreatedFlag {
|
||||
row += user.DateCreated
|
||||
}
|
||||
fmt.Fprintln(os.Stdout, row)
|
||||
|
@ -131,7 +131,7 @@ func cmdListUsers(args []string) error {
|
|||
os.Exit(1)
|
||||
}
|
||||
// Printing the header
|
||||
if *headerFlag {
|
||||
if !*headerFlag {
|
||||
header := paneldb.User{
|
||||
UserName: "username",
|
||||
Email: "email",
|
||||
|
|
10
db/db.go
10
db/db.go
|
@ -9,11 +9,11 @@ import (
|
|||
)
|
||||
|
||||
type User struct {
|
||||
Id string
|
||||
UserName string
|
||||
Email string
|
||||
DateCreated string
|
||||
PasswordHash string
|
||||
ID string `sql:"uid"`
|
||||
UserName string `sql:"username"`
|
||||
Email string `sql:"email"`
|
||||
DateCreated string `sql:"date_created"`
|
||||
PasswordHash string `sql:"password"`
|
||||
}
|
||||
|
||||
type DB struct {
|
||||
|
|
Reference in a new issue