Skip to content

Commit dfe672e

Browse files
committed
code reformat
1 parent efc6fb5 commit dfe672e

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

internal/auth/middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"net/http"
66
"strconv"
77

8-
"github.com/glyphack/go-graphql-hackernews/internal/users"
9-
"github.com/glyphack/go-graphql-hackernews/pkg/jwt"
8+
"github.com/glyphack/graphlq-golang/internal/users"
9+
"github.com/glyphack/graphlq-golang/pkg/jwt"
1010
)
1111

1212
var userCtxKey = &contextKey{"user"}

internal/links/links.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package links
22

33
import (
4-
database "github.com/glyphack/go-graphql-hackernews/internal/pkg/db/mysql"
5-
"github.com/glyphack/go-graphql-hackernews/internal/users"
4+
database "github.com/glyphack/graphlq-golang/internal/pkg/db/mysql"
5+
"github.com/glyphack/graphlq-golang/internal/users"
66
"log"
77
)
88

@@ -15,7 +15,7 @@ type Link struct {
1515
}
1616

1717
//#2
18-
func (link Link) Save() int64 {
18+
func (link Link) Save() int64 {
1919
//#3
2020
statement, err := database.Db.Prepare("INSERT INTO Links(Title,Address, UserID) VALUES(?,?, ?)")
2121
if err != nil {
@@ -35,7 +35,6 @@ func (link Link) Save() int64 {
3535
return id
3636
}
3737

38-
3938
func GetAll() []Link {
4039
stmt, err := database.Db.Prepare("select L.id, L.title, L.address, L.UserID, U.Username from Links L inner join Users U on L.UserID = U.ID")
4140
if err != nil {
@@ -53,7 +52,7 @@ func GetAll() []Link {
5352
for rows.Next() {
5453
var link Link
5554
err := rows.Scan(&link.ID, &link.Title, &link.Address, &id, &username)
56-
if err != nil{
55+
if err != nil {
5756
log.Fatal(err)
5857
}
5958
link.User = &users.User{
@@ -66,4 +65,4 @@ func GetAll() []Link {
6665
log.Fatal(err)
6766
}
6867
return links
69-
}
68+
}

internal/pkg/db/mysql/mysql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func InitDB() {
1818
}
1919

2020
if err = db.Ping(); err != nil {
21-
log.Panic(err)
21+
log.Panic(err)
2222
}
2323
Db = db
2424
}
@@ -37,4 +37,4 @@ func Migrate() {
3737
log.Fatal(err)
3838
}
3939

40-
}
40+
}

internal/users/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ type WrongUsernameOrPasswordError struct{}
44

55
func (m *WrongUsernameOrPasswordError) Error() string {
66
return "wrong username or password"
7-
}
7+
}

internal/users/users.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package users
22

33
import (
44
"database/sql"
5-
"github.com/glyphack/go-graphql-hackernews/internal/pkg/db/mysql"
5+
"github.com/glyphack/graphlq-golang/internal/pkg/db/mysql"
66
"golang.org/x/crypto/bcrypt"
77
"log"
88
)
@@ -83,7 +83,7 @@ func GetUsernameById(userId string) (User, error) {
8383
return User{}, err
8484
}
8585

86-
return User{ID:userId, Username:username}, nil
86+
return User{ID: userId, Username: username}, nil
8787
}
8888

8989
//HashPassword hashes given password

0 commit comments

Comments
 (0)