Add the module name after the path to the repo and simply name it ersteller
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
# Private gitlab repo hosting
|
# Private gitlab repo hosting
|
||||||
|
|
||||||
`git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"`
|
`git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"`
|
||||||
|
|
||||||
|
`go env -w GOPRIVATE=gitlab.com`
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package authentication
|
package authentication
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "git.gorlug.de/code/golang/ersteller-lib"
|
. "git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/authentication"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/authentication"
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
@@ -35,7 +35,7 @@ type Auth struct {
|
|||||||
isLocal bool
|
isLocal bool
|
||||||
userRepo authentication.UserRepository
|
userRepo authentication.UserRepository
|
||||||
sessionStore *sessions.CookieStore
|
sessionStore *sessions.CookieStore
|
||||||
GoogleLoginRoute ersteller_lib.Route
|
GoogleLoginRoute ersteller.Route
|
||||||
environment AuthEnv
|
environment AuthEnv
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,10 +64,10 @@ func (a *Auth) GetAuthURL(state string) string {
|
|||||||
func (a *Auth) ParseUserData(code string) (GoogleUserData, error) {
|
func (a *Auth) ParseUserData(code string) (GoogleUserData, error) {
|
||||||
data, err := a.getUserDataFromGoogle(code)
|
data, err := a.getUserDataFromGoogle(code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed getting user data from Google: %v", err)
|
ersteller.LogError("failed getting user data from Google: %v", err)
|
||||||
return GoogleUserData{}, err
|
return GoogleUserData{}, err
|
||||||
}
|
}
|
||||||
ersteller_lib.LogDebug("user data: %v", data)
|
ersteller.LogDebug("user data: %v", data)
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,25 +75,25 @@ func (a *Auth) getUserDataFromGoogle(code string) (GoogleUserData, error) {
|
|||||||
// Use code to get token and get user info from Google.
|
// Use code to get token and get user info from Google.
|
||||||
token, err := a.Config.Exchange(context.Background(), code)
|
token, err := a.Config.Exchange(context.Background(), code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("code exchange wrong: %v", err)
|
ersteller.LogError("code exchange wrong: %v", err)
|
||||||
return GoogleUserData{}, err
|
return GoogleUserData{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := http.Get(oauthGoogleUrlAPI + token.AccessToken)
|
response, err := http.Get(oauthGoogleUrlAPI + token.AccessToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed getting user info: %v", err)
|
ersteller.LogError("failed getting user info: %v", err)
|
||||||
return GoogleUserData{}, nil
|
return GoogleUserData{}, nil
|
||||||
}
|
}
|
||||||
defer response.Body.Close()
|
defer response.Body.Close()
|
||||||
contents, err := ioutil.ReadAll(response.Body)
|
contents, err := ioutil.ReadAll(response.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed read response: %v", err)
|
ersteller.LogError("failed read response: %v", err)
|
||||||
return GoogleUserData{}, nil
|
return GoogleUserData{}, nil
|
||||||
}
|
}
|
||||||
userData := GoogleUserData{}
|
userData := GoogleUserData{}
|
||||||
err = json.Unmarshal(contents, &userData)
|
err = json.Unmarshal(contents, &userData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to unmarshal user data: %v", err)
|
ersteller.LogError("failed to unmarshal user data: %v", err)
|
||||||
return GoogleUserData{}, nil
|
return GoogleUserData{}, nil
|
||||||
}
|
}
|
||||||
userData.Token = token
|
userData.Token = token
|
||||||
@@ -102,10 +102,10 @@ func (a *Auth) getUserDataFromGoogle(code string) (GoogleUserData, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Auth) SaveCredentials(userId int, token *oauth2.Token) error {
|
func (a *Auth) SaveCredentials(userId int, token *oauth2.Token) error {
|
||||||
ersteller_lib.Debug("saving google credentials for user ", userId)
|
ersteller.Debug("saving google credentials for user ", userId)
|
||||||
googleAuth, err := a.repo.ReadByUserId(userId)
|
googleAuth, err := a.repo.ReadByUserId(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogDebug("no GoogleAuth found for user %d, creating new one", userId)
|
ersteller.LogDebug("no GoogleAuth found for user %d, creating new one", userId)
|
||||||
_, err = a.repo.Create(GoogleAuth{
|
_, err = a.repo.Create(GoogleAuth{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
Credentials: Credentials{
|
Credentials: Credentials{
|
||||||
@@ -121,11 +121,11 @@ func (a *Auth) SaveCredentials(userId int, token *oauth2.Token) error {
|
|||||||
func (a *Auth) GetCredentials(userId int) (*oauth2.Token, error) {
|
func (a *Auth) GetCredentials(userId int) (*oauth2.Token, error) {
|
||||||
credentials, err := a.repo.ReadByUserId(userId)
|
credentials, err := a.repo.ReadByUserId(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to get credentials for user %d: %v", userId, err)
|
ersteller.LogError("failed to get credentials for user %d: %v", userId, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if credentials.Credentials.Token.AccessToken == "" {
|
if credentials.Credentials.Token.AccessToken == "" {
|
||||||
ersteller_lib.LogError("no credentials found for user %d", userId)
|
ersteller.LogError("no credentials found for user %d", userId)
|
||||||
return nil, errors.New("no credentials found")
|
return nil, errors.New("no credentials found")
|
||||||
}
|
}
|
||||||
return &credentials.Credentials.Token, nil
|
return &credentials.Credentials.Token, nil
|
||||||
@@ -135,25 +135,25 @@ const oAuthStateCookieName = "oauthstate"
|
|||||||
const GoogleLogin = "/login/google"
|
const GoogleLogin = "/login/google"
|
||||||
const GoogleLoginCallback = "/email/authenticated"
|
const GoogleLoginCallback = "/email/authenticated"
|
||||||
|
|
||||||
func (a *Auth) AddRoutes(e *echo.Echo) []ersteller_lib.Route {
|
func (a *Auth) AddRoutes(e *echo.Echo) []ersteller.Route {
|
||||||
googleLoginRoute := ersteller_lib.NewGetRoute(GoogleLogin, func(c echo.Context) error {
|
googleLoginRoute := ersteller.NewGetRoute(GoogleLogin, func(c echo.Context) error {
|
||||||
state := a.generateStateOauthCookie(c.Response())
|
state := a.generateStateOauthCookie(c.Response())
|
||||||
ersteller_lib.LogDebug("Value: %v", state)
|
ersteller.LogDebug("Value: %v", state)
|
||||||
authenticationUrl := a.GetAuthURL(state)
|
authenticationUrl := a.GetAuthURL(state)
|
||||||
return c.Redirect(http.StatusTemporaryRedirect, authenticationUrl)
|
return c.Redirect(http.StatusTemporaryRedirect, authenticationUrl)
|
||||||
})
|
})
|
||||||
googleLoginRoute.Add(e)
|
googleLoginRoute.Add(e)
|
||||||
a.GoogleLoginRoute = googleLoginRoute
|
a.GoogleLoginRoute = googleLoginRoute
|
||||||
|
|
||||||
authenticatedRoute := ersteller_lib.NewGetRoute(GoogleLoginCallback, func(c echo.Context) error {
|
authenticatedRoute := ersteller.NewGetRoute(GoogleLoginCallback, func(c echo.Context) error {
|
||||||
ersteller_lib.LogDebug("email authenticated called")
|
ersteller.LogDebug("email authenticated called")
|
||||||
oauthstate, err := c.Cookie(oAuthStateCookieName)
|
oauthstate, err := c.Cookie(oAuthStateCookieName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to get cookie: %v", err)
|
ersteller.LogError("Failed to get cookie: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if c.FormValue("state") != oauthstate.Value {
|
if c.FormValue("state") != oauthstate.Value {
|
||||||
ersteller_lib.LogError("Failed to verify google oauth state")
|
ersteller.LogError("Failed to verify google oauth state")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
code := c.FormValue("code")
|
code := c.FormValue("code")
|
||||||
@@ -163,10 +163,10 @@ func (a *Auth) AddRoutes(e *echo.Echo) []ersteller_lib.Route {
|
|||||||
}
|
}
|
||||||
userId, err := a.userRepo.GetUserId(data.Email)
|
userId, err := a.userRepo.GetUserId(data.Email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to get user id: %v", err)
|
ersteller.LogError("Failed to get user id: %v", err)
|
||||||
userId, err = a.userRepo.CreateFromEmail(data.Email)
|
userId, err = a.userRepo.CreateFromEmail(data.Email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create user: %v", err)
|
ersteller.LogError("Failed to create user: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,36 +176,36 @@ func (a *Auth) AddRoutes(e *echo.Echo) []ersteller_lib.Route {
|
|||||||
}
|
}
|
||||||
err = a.SaveCredentials(userId, data.Token)
|
err = a.SaveCredentials(userId, data.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("failed to save credentials for user ", userId, ": ", err)
|
ersteller.Error("failed to save credentials for user ", userId, ": ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ersteller_lib.Debug("saved credentials for user", userId)
|
ersteller.Debug("saved credentials for user", userId)
|
||||||
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
||||||
})
|
})
|
||||||
authenticatedRoute.Add(e)
|
authenticatedRoute.Add(e)
|
||||||
|
|
||||||
logoutRoute := ersteller_lib.NewGetRoute("/logout", func(c echo.Context) error {
|
logoutRoute := ersteller.NewGetRoute("/logout", func(c echo.Context) error {
|
||||||
// Clear the session
|
// Clear the session
|
||||||
session, err := a.sessionStore.Get(c.Request(), a.environment.SessionName)
|
session, err := a.sessionStore.Get(c.Request(), a.environment.SessionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to get session: %v", err)
|
ersteller.LogError("Failed to get session: %v", err)
|
||||||
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
||||||
}
|
}
|
||||||
session.Options.MaxAge = -1
|
session.Options.MaxAge = -1
|
||||||
err = session.Save(c.Request(), c.Response())
|
err = session.Save(c.Request(), c.Response())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to save session: %v", err)
|
ersteller.LogError("Failed to save session: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
return c.Redirect(http.StatusTemporaryRedirect, "/")
|
||||||
})
|
})
|
||||||
logoutRoute.Add(e)
|
logoutRoute.Add(e)
|
||||||
return []ersteller_lib.Route{googleLoginRoute, authenticatedRoute, logoutRoute}
|
return []ersteller.Route{googleLoginRoute, authenticatedRoute, logoutRoute}
|
||||||
}
|
}
|
||||||
func (a *Auth) saveEmailToSessionStore(c echo.Context, email string, userId int) error {
|
func (a *Auth) saveEmailToSessionStore(c echo.Context, email string, userId int) error {
|
||||||
session, err := a.sessionStore.New(c.Request(), a.environment.SessionName)
|
session, err := a.sessionStore.New(c.Request(), a.environment.SessionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create session: %v", err)
|
ersteller.LogError("Failed to create session: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
session.Values = map[interface{}]interface{}{
|
session.Values = map[interface{}]interface{}{
|
||||||
@@ -214,7 +214,7 @@ func (a *Auth) saveEmailToSessionStore(c echo.Context, email string, userId int)
|
|||||||
}
|
}
|
||||||
err = session.Save(c.Request(), c.Response())
|
err = session.Save(c.Request(), c.Response())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to save session: %v", err)
|
ersteller.LogError("Failed to save session: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -224,7 +224,7 @@ func (a *Auth) generateStateOauthCookie(w http.ResponseWriter) string {
|
|||||||
b := make([]byte, 16)
|
b := make([]byte, 16)
|
||||||
_, err := rand.Read(b)
|
_, err := rand.Read(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to read random state: %v", err)
|
ersteller.LogError("Failed to read random state: %v", err)
|
||||||
}
|
}
|
||||||
state := base64.URLEncoding.EncodeToString(b)
|
state := base64.URLEncoding.EncodeToString(b)
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package google
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/doug-martin/goqu/v9"
|
"github.com/doug-martin/goqu/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *GoogleAuthRepository) ReadByUserId(userId int) (GoogleAuth, error) {
|
func (r *GoogleAuthRepository) ReadByUserId(userId int) (GoogleAuth, error) {
|
||||||
ersteller_lib.Debug("Getting GoogleAuth by userId", userId)
|
ersteller.Debug("Getting GoogleAuth by userId", userId)
|
||||||
sql, args, _ := r.dialect.From("googleAuth").
|
sql, args, _ := r.dialect.From("googleAuth").
|
||||||
Prepared(true).
|
Prepared(true).
|
||||||
Select(r.getSelectColumns()...).
|
Select(r.getSelectColumns()...).
|
||||||
@@ -19,7 +19,7 @@ func (r *GoogleAuthRepository) ReadByUserId(userId int) (GoogleAuth, error) {
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("Failed to get GoogleAuth: ", err)
|
ersteller.Error("Failed to get GoogleAuth: ", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
if rows.Next() {
|
if rows.Next() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/doug-martin/goqu/v9"
|
"github.com/doug-martin/goqu/v9"
|
||||||
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
|
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
|
||||||
"github.com/doug-martin/goqu/v9/exp"
|
"github.com/doug-martin/goqu/v9/exp"
|
||||||
@@ -42,13 +42,13 @@ func (r *GoogleAuthRepository) Create(googleAuth GoogleAuth) (int, error) {
|
|||||||
Returning("id").
|
Returning("id").
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating create GoogleAuth sql: %v", err)
|
ersteller.LogError("error creating create GoogleAuth sql: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating GoogleAuth: %v", err)
|
ersteller.LogError("error creating GoogleAuth: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
@@ -56,11 +56,11 @@ func (r *GoogleAuthRepository) Create(googleAuth GoogleAuth) (int, error) {
|
|||||||
if rows.Next() {
|
if rows.Next() {
|
||||||
err = rows.Scan(&id)
|
err = rows.Scan(&id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error scanning User: %v", err)
|
ersteller.LogError("error scanning User: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ersteller_lib.Error("GoogleAuth already exists")
|
ersteller.Error("GoogleAuth already exists")
|
||||||
return -1, GoogleAuthAlreadyExistsError{GoogleAuth: googleAuth}
|
return -1, GoogleAuthAlreadyExistsError{GoogleAuth: googleAuth}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ func (r *GoogleAuthRepository) getSelectColumns() []any {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *GoogleAuthRepository) Read(userId int, id int) (GoogleAuth, error) {
|
func (r *GoogleAuthRepository) Read(userId int, id int) (GoogleAuth, error) {
|
||||||
ersteller_lib.Debug("Getting GoogleAuth by id ", id)
|
ersteller.Debug("Getting GoogleAuth by id ", id)
|
||||||
sql, args, _ := r.dialect.From("googleAuth").
|
sql, args, _ := r.dialect.From("googleAuth").
|
||||||
Prepared(true).
|
Prepared(true).
|
||||||
Select(r.getSelectColumns()...).
|
Select(r.getSelectColumns()...).
|
||||||
@@ -95,7 +95,7 @@ func (r *GoogleAuthRepository) Read(userId int, id int) (GoogleAuth, error) {
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("Failed to get GoogleAuth: ", err)
|
ersteller.Error("Failed to get GoogleAuth: ", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
if rows.Next() {
|
if rows.Next() {
|
||||||
@@ -162,13 +162,13 @@ func (r *GoogleAuthRepository) Update(userId int, googleAuth GoogleAuth) error {
|
|||||||
}).
|
}).
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating update GoogleAuth sql: %v", err)
|
ersteller.LogError("error creating update GoogleAuth sql: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error updating GoogleAuth: %v", err)
|
ersteller.LogError("error updating GoogleAuth: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,13 +184,13 @@ func (r *GoogleAuthRepository) Delete(userId int, id int) error {
|
|||||||
}).
|
}).
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating delete GoogleAuth sql: %v", err)
|
ersteller.LogError("error creating delete GoogleAuth sql: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error deleting GoogleAuth: %v", err)
|
ersteller.LogError("error deleting GoogleAuth: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ func (r *GoogleAuthRepository) GetPage(params GoogleAuthPaginationParams) ([]Goo
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to run sql query: %v", err)
|
ersteller.LogError("failed to run sql query: %v", err)
|
||||||
return nil, -1, err
|
return nil, -1, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
. "git.gorlug.de/code/golang/ersteller-lib"
|
. "git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/authentication"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/authentication"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
+10
-10
@@ -2,7 +2,7 @@ package authentication
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/markbates/goth"
|
"github.com/markbates/goth"
|
||||||
@@ -38,7 +38,7 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
|||||||
// ignore the error for now
|
// ignore the error for now
|
||||||
openid, err := openidConnect.New(environment.Keycloak.ClientId, environment.Keycloak.ClientSecret, environment.BaseUrl+"/auth/openid-connect/callback", environment.Keycloak.DiscoveryUrl)
|
openid, err := openidConnect.New(environment.Keycloak.ClientId, environment.Keycloak.ClientSecret, environment.BaseUrl+"/auth/openid-connect/callback", environment.Keycloak.DiscoveryUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("Error while initializing OpenID Connect provider: ", err)
|
ersteller.Error("Error while initializing OpenID Connect provider: ", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if openid != nil {
|
if openid != nil {
|
||||||
@@ -56,12 +56,12 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
|||||||
if userId == -1 {
|
if userId == -1 {
|
||||||
userId, err = createUser(user, userRepo)
|
userId, err = createUser(user, userRepo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create user: %v", err)
|
ersteller.LogError("Failed to create user: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ersteller_lib.LogDebug("Created user with id %d", userId)
|
ersteller.LogDebug("Created user with id %d", userId)
|
||||||
} else {
|
} else {
|
||||||
ersteller_lib.LogError("Failed to get user id: %v", err)
|
ersteller.LogError("Failed to get user id: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
|||||||
// Get the session
|
// Get the session
|
||||||
session, err := cookieStore.Get(c.Request(), environment.SessionName)
|
session, err := cookieStore.Get(c.Request(), environment.SessionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to get session during logout: %v", err)
|
ersteller.LogError("Failed to get session during logout: %v", err)
|
||||||
} else {
|
} else {
|
||||||
// Clear session values
|
// Clear session values
|
||||||
session.Values = make(map[interface{}]interface{})
|
session.Values = make(map[interface{}]interface{})
|
||||||
@@ -85,7 +85,7 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
|||||||
// Save the session (this will delete the cookie)
|
// Save the session (this will delete the cookie)
|
||||||
err = session.Save(c.Request(), c.Response())
|
err = session.Save(c.Request(), c.Response())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to clear session during logout: %v", err)
|
ersteller.LogError("Failed to clear session during logout: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
|||||||
request := c.Request().WithContext(ctx)
|
request := c.Request().WithContext(ctx)
|
||||||
// try to get the user without re-authenticating
|
// try to get the user without re-authenticating
|
||||||
if gothUser, err := gothic.CompleteUserAuth(c.Response(), c.Request()); err == nil {
|
if gothUser, err := gothic.CompleteUserAuth(c.Response(), c.Request()); err == nil {
|
||||||
ersteller_lib.Debug(gothUser)
|
ersteller.Debug(gothUser)
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
gothic.BeginAuthHandler(c.Response(), request)
|
gothic.BeginAuthHandler(c.Response(), request)
|
||||||
@@ -122,7 +122,7 @@ func createUser(gothUser goth.User, repo UserRepository) (int, error) {
|
|||||||
func saveEmailToSessionStore(c echo.Context, sessionStore *sessions.CookieStore, email string, userId int, environment KeycloakEnv) error {
|
func saveEmailToSessionStore(c echo.Context, sessionStore *sessions.CookieStore, email string, userId int, environment KeycloakEnv) error {
|
||||||
session, err := sessionStore.New(c.Request(), environment.SessionName)
|
session, err := sessionStore.New(c.Request(), environment.SessionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create session: %v", err)
|
ersteller.LogError("Failed to create session: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
session.Values = map[interface{}]interface{}{
|
session.Values = map[interface{}]interface{}{
|
||||||
@@ -131,7 +131,7 @@ func saveEmailToSessionStore(c echo.Context, sessionStore *sessions.CookieStore,
|
|||||||
}
|
}
|
||||||
err = session.Save(c.Request(), c.Response())
|
err = session.Save(c.Request(), c.Response())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to save session: %v", err)
|
ersteller.LogError("Failed to save session: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package authentication
|
package authentication
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"maragu.dev/gomponents"
|
"maragu.dev/gomponents"
|
||||||
. "maragu.dev/gomponents/html"
|
. "maragu.dev/gomponents/html"
|
||||||
@@ -10,22 +10,22 @@ import (
|
|||||||
const LoginPath = "/login"
|
const LoginPath = "/login"
|
||||||
|
|
||||||
type LoginPage struct {
|
type LoginPage struct {
|
||||||
createPage ersteller_lib.CreatePageFunc
|
createPage ersteller.CreatePageFunc
|
||||||
LoginRoute ersteller_lib.GetRoute
|
LoginRoute ersteller.GetRoute
|
||||||
googleLoginUrl string
|
googleLoginUrl string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLoginPage(e *echo.Echo, createPage ersteller_lib.CreatePageFunc, googleLoginUrl string) *LoginPage {
|
func NewLoginPage(e *echo.Echo, createPage ersteller.CreatePageFunc, googleLoginUrl string) *LoginPage {
|
||||||
page := &LoginPage{createPage: createPage, googleLoginUrl: googleLoginUrl}
|
page := &LoginPage{createPage: createPage, googleLoginUrl: googleLoginUrl}
|
||||||
page.LoginRoute = ersteller_lib.NewGetRoute(LoginPath, page.Render).Add(e)
|
page.LoginRoute = ersteller.NewGetRoute(LoginPath, page.Render).Add(e)
|
||||||
return page
|
return page
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LoginPage) Render(c echo.Context) error {
|
func (l *LoginPage) Render(c echo.Context) error {
|
||||||
return l.createPage(c, ersteller_lib.PageWebsiteMetaData{
|
return l.createPage(c, ersteller.PageWebsiteMetaData{
|
||||||
Title: ersteller_lib.NewI18nText(map[ersteller_lib.Language]string{
|
Title: ersteller.NewI18nText(map[ersteller.Language]string{
|
||||||
ersteller_lib.En: "Login",
|
ersteller.En: "Login",
|
||||||
ersteller_lib.De: "Anmelden",
|
ersteller.De: "Anmelden",
|
||||||
}),
|
}),
|
||||||
HideNavigation: true,
|
HideNavigation: true,
|
||||||
}, l.getLoginPage())
|
}, l.getLoginPage())
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@@ -10,13 +10,13 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
err := godotenv.Load()
|
err := godotenv.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Error loading .env file: %v", err)
|
ersteller.LogError("Error loading .env file: %v", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
dbUrl := os.Getenv("DATABASE_URL")
|
dbUrl := os.Getenv("DATABASE_URL")
|
||||||
connpool, err := ersteller_lib.CreatePostgresConnpool(dbUrl)
|
connpool, err := ersteller.CreatePostgresConnpool(dbUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create connection pool: %v", err)
|
ersteller.LogError("Failed to create connection pool: %v", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
// https://medium.com/israeli-tech-radar/postgresql-trigger-based-audit-log-fd9d9d5e412c
|
// https://medium.com/israeli-tech-radar/postgresql-trigger-based-audit-log-fd9d9d5e412c
|
||||||
@@ -133,7 +133,7 @@ CREATE OR REPLACE TRIGGER audit_log_trigger
|
|||||||
`
|
`
|
||||||
_, err = connpool.Exec(context.Background(), sql)
|
_, err = connpool.Exec(context.Background(), sql)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("Failed to create audit log table: %v", err)
|
ersteller.LogError("Failed to create audit log table: %v", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
println("Created audit log table")
|
println("Created audit log table")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module git.gorlug.de/code/golang/ersteller-lib
|
module git.gorlug.de/code/golang/ersteller-lib/ersteller
|
||||||
|
|
||||||
go 1.25.0
|
go 1.25.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
// https://medium.com/@rnp0728/secure-password-hashing-in-go-a-comprehensive-guide-5500e19e7c1f
|
// https://medium.com/@rnp0728/secure-password-hashing-in-go-a-comprehensive-guide-5500e19e7c1f
|
||||||
import "golang.org/x/crypto/bcrypt"
|
import "golang.org/x/crypto/bcrypt"
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ package htmx
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ type LocationRedirectParams struct {
|
|||||||
func LocationRedirect(c echo.Context, params LocationRedirectParams) error {
|
func LocationRedirect(c echo.Context, params LocationRedirectParams) error {
|
||||||
jsonData, err := json.Marshal(params)
|
jsonData, err := json.Marshal(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("Failed to marshal LocationRedirectParams ", params, err)
|
ersteller.Error("Failed to marshal LocationRedirectParams ", params, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ersteller_lib.Debug("LocationRedirectParams", params, "jsonData", string(jsonData))
|
ersteller.Debug("LocationRedirectParams", params, "jsonData", string(jsonData))
|
||||||
c.Response().Header().Set("HX-Location", string(jsonData))
|
c.Response().Header().Set("HX-Location", string(jsonData))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
type Language string
|
type Language string
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
@@ -151,7 +151,7 @@ type MistralClient interface {
|
|||||||
type MistralClientMock struct{}
|
type MistralClientMock struct{}
|
||||||
|
|
||||||
func (m MistralClientMock) CreateChatCompletion(req *ChatCompletionRequest) (*ChatCompletionResponse, error) {
|
func (m MistralClientMock) CreateChatCompletion(req *ChatCompletionRequest) (*ChatCompletionResponse, error) {
|
||||||
ersteller_lib.Debug("mocking the mistral client")
|
ersteller.Debug("mocking the mistral client")
|
||||||
response := ChatCompletionResponse{
|
response := ChatCompletionResponse{
|
||||||
Choices: []ChatCompletionChoice{
|
Choices: []ChatCompletionChoice{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
// https://github.com/golang-migrate/migrate
|
// https://github.com/golang-migrate/migrate
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
// https://entgo.io/docs/getting-started/#setup-a-go-environment
|
// https://entgo.io/docs/getting-started/#setup-a-go-environment
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/migrate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/migrate"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ package enttest
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/runtime"
|
_ "git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/runtime"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/migrate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/migrate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package hook
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The GroupFunc type is an adapter to allow the use of ordinary
|
// The GroupFunc type is an adapter to allow the use of ordinary
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
package ent
|
package ent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package todo
|
package todo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package ent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/group"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/group"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/schema/ent/example/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/schema/ent/example/ent/user"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package create
|
|||||||
import (
|
import (
|
||||||
. "ersteller-lib"
|
. "ersteller-lib"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/env"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/env"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/migrate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/migrate"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
|
|||||||
+3
-3
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ package enttest
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "git.gorlug.de/code/golang/ersteller-lib/starter/ent/runtime"
|
_ "git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/runtime"
|
||||||
|
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/migrate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/migrate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package ent
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package googleauth
|
package googleauth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package ent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package hook
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The GoogleAuthFunc type is an adapter to allow the use of ordinary
|
// The GoogleAuthFunc type is an adapter to allow the use of ordinary
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
package ent
|
package ent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/googleauth"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/googleauth"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/schema"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/schema"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package todo
|
package todo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package ent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ package ent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/predicate"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/predicate"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/create"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/create"
|
||||||
"log"
|
"log"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module git.gorlug.de/code/golang/ersteller-lib/starter
|
module git.gorlug.de/code/golang/ersteller-lib/ersteller/starter
|
||||||
|
|
||||||
go 1.25.0
|
go 1.25.0
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
ersteller_lib "ersteller-lib"
|
ersteller_lib "ersteller-lib"
|
||||||
google_http "ersteller-lib/authentication/google/http"
|
google_http "ersteller-lib/authentication/google/http"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/user"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Database struct {
|
type Database struct {
|
||||||
|
|||||||
+3
-3
@@ -3,9 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
. "ersteller-lib"
|
. "ersteller-lib"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/env"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/env"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/routes"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/routes"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import (
|
|||||||
. "ersteller-lib"
|
. "ersteller-lib"
|
||||||
"ersteller-lib/authentication"
|
"ersteller-lib/authentication"
|
||||||
google_http "ersteller-lib/authentication/google/http"
|
google_http "ersteller-lib/authentication/google/http"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/about"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/about"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/contact"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/contact"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/env"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/env"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/google"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/google"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/index"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/index"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/login"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/login"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/page"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/page"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/todos"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/todos"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "ersteller-lib"
|
. "ersteller-lib"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib/starter/ent/todo"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller/starter/ent/todo"
|
||||||
|
|
||||||
. "maragu.dev/gomponents"
|
. "maragu.dev/gomponents"
|
||||||
. "maragu.dev/gomponents/html"
|
. "maragu.dev/gomponents/html"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ersteller_lib
|
package ersteller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|||||||
+15
-15
@@ -5,7 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.gorlug.de/code/golang/ersteller-lib"
|
"git.gorlug.de/code/golang/ersteller-lib/ersteller"
|
||||||
"github.com/doug-martin/goqu/v9"
|
"github.com/doug-martin/goqu/v9"
|
||||||
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
|
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
|
||||||
"github.com/doug-martin/goqu/v9/exp"
|
"github.com/doug-martin/goqu/v9/exp"
|
||||||
@@ -41,13 +41,13 @@ func (r *UserRepository) Create(user User) (int, error) {
|
|||||||
Returning("id").
|
Returning("id").
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating create User sql: %v", err)
|
ersteller.LogError("error creating create User sql: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating User: %v", err)
|
ersteller.LogError("error creating User: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
@@ -55,11 +55,11 @@ func (r *UserRepository) Create(user User) (int, error) {
|
|||||||
if rows.Next() {
|
if rows.Next() {
|
||||||
err = rows.Scan(&id)
|
err = rows.Scan(&id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error scanning User: %v", err)
|
ersteller.LogError("error scanning User: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ersteller_lib.Error("User already exists")
|
ersteller.Error("User already exists")
|
||||||
return -1, UserAlreadyExistsError{User: user}
|
return -1, UserAlreadyExistsError{User: user}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ func (r *UserRepository) getSelectColumns() []any {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *UserRepository) Read(id int) (User, error) {
|
func (r *UserRepository) Read(id int) (User, error) {
|
||||||
ersteller_lib.Debug("Getting User by id ", id)
|
ersteller.Debug("Getting User by id ", id)
|
||||||
sql, args, _ := r.dialect.From("user").
|
sql, args, _ := r.dialect.From("user").
|
||||||
Prepared(true).
|
Prepared(true).
|
||||||
Select(r.getSelectColumns()...).
|
Select(r.getSelectColumns()...).
|
||||||
@@ -93,7 +93,7 @@ func (r *UserRepository) Read(id int) (User, error) {
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.Error("Failed to get User: ", err)
|
ersteller.Error("Failed to get User: ", err)
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
if rows.Next() {
|
if rows.Next() {
|
||||||
@@ -167,13 +167,13 @@ func (r *UserRepository) Update(user User) error {
|
|||||||
}).
|
}).
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating update User sql: %v", err)
|
ersteller.LogError("error creating update User sql: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error updating User: %v", err)
|
ersteller.LogError("error updating User: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,13 +188,13 @@ func (r *UserRepository) Delete(id int) error {
|
|||||||
}).
|
}).
|
||||||
ToSQL()
|
ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error creating delete User sql: %v", err)
|
ersteller.LogError("error creating delete User sql: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
_, err = r.connPool.Exec(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("error deleting User: %v", err)
|
ersteller.LogError("error deleting User: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ func (r *UserRepository) GetPage(params UserPaginationParams) ([]User, int, erro
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to run sql query: %v", err)
|
ersteller.LogError("failed to run sql query: %v", err)
|
||||||
return nil, -1, err
|
return nil, -1, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
@@ -342,7 +342,7 @@ func (r *UserRepository) DoesUserEmailExist(email string) (bool, error) {
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to run sql query: %v", err)
|
ersteller.LogError("failed to run sql query: %v", err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
@@ -366,7 +366,7 @@ func (r *UserRepository) GetUserId(email string) (int, error) {
|
|||||||
|
|
||||||
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
rows, err := r.connPool.Query(context.Background(), sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ersteller_lib.LogError("failed to run sql query: %v", err)
|
ersteller.LogError("failed to run sql query: %v", err)
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
@@ -396,5 +396,5 @@ func (r *UserRepository) VerifyPassword(email string, password string) (bool, in
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, -1, err
|
return false, -1, err
|
||||||
}
|
}
|
||||||
return ersteller_lib.VerifyPassword(password, user.Password), userId, nil
|
return ersteller.VerifyPassword(password, user.Password), userId, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user