Skip to content

Commit

Permalink
backup commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilnarayanan623 committed Jul 30, 2023
1 parent 99d3b32 commit 36540c1
Show file tree
Hide file tree
Showing 127 changed files with 76 additions and 47 deletions.
Empty file modified .github/workflows/main.yml
100755 → 100644
Empty file.
Empty file modified .gitignore
100755 → 100644
Empty file.
Empty file modified Dockerfile
100755 → 100644
Empty file.
8 changes: 5 additions & 3 deletions cmd/api/main.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ func main() {
cfg, err := config.LoadConfig()

if err != nil {
log.Fatal("Error to load the config")
log.Fatal("Error to load the config: ", err)
}

server, err := di.InitializeApi(cfg)
if err != nil {
log.Fatal("Failed to initialize the api")
log.Fatal("Failed to initialize the api: ", err)
}

server.Start()
if server.Start(); err != nil {
log.Fatal("failed to start server: ", err)
}
}
Empty file modified docker-compose.yml
100755 → 100644
Empty file.
Empty file modified ecommerce-kubernet.yaml
100755 → 100644
Empty file.
Empty file modified go.mod
100755 → 100644
Empty file.
Empty file modified go.sum
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ swagger: ## install swagger and its dependencies for generate swagger using swag
swag: ## Generate swagger docs
swag init -g pkg/api/server.go -o ./cmd/api/docs

check: ## To check the code standard violations and errors
golangci-lint run

mockgen: # Generate mock files for the test
mockgen -source=pkg/repository/interfaces/auth.go -destination=pkg/mock/mockrepo/auth_mock.go -package=mockrepo
mockgen -source=pkg/repository/interfaces/user.go -destination=pkg/mock/mockrepo/user_mock.go -package=mockrepo
Expand Down
Empty file modified pkg/api/handler/admin.go
100755 → 100644
Empty file.
5 changes: 4 additions & 1 deletion pkg/api/handler/auth.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ func (c *AuthHandler) UserSignUp(ctx *gin.Context) {
}

var user domain.User
copier.Copy(&user, body)
if err := copier.Copy(&user, body); err != nil {
response.ErrorResponse(ctx, http.StatusInternalServerError, "failed to copy details", err, nil)
return
}

err := c.authUseCase.UserSignUp(ctx, user)

Expand Down
10 changes: 6 additions & 4 deletions pkg/api/handler/auth_google.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/jinzhu/copier"
"github.com/markbates/goth"
"github.com/markbates/goth/gothic"
"github.com/markbates/goth/providers/google"
Expand Down Expand Up @@ -68,9 +67,12 @@ func (c *AuthHandler) UserGoogleAuthCallBack(ctx *gin.Context) {
return
}

var user domain.User

copier.Copy(&user, &googleUser)
user := domain.User{
FirstName: googleUser.FirstName,
LastName: googleUser.LastName,
Email: googleUser.Email,
GoogleImage: googleUser.AvatarURL,
}

userID, err := c.authUseCase.GoogleLogin(ctx, user)
if err != nil {
Expand Down
9 changes: 7 additions & 2 deletions pkg/api/handler/auth_test.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ func TestUserRenewRefreshToken(t *testing.T) {
assert.NoError(t, err)

var tokenResponse response.TokenResponse
json.Unmarshal(jsonData, &tokenResponse)
err = json.Unmarshal(jsonData, &tokenResponse)
assert.NoError(t, err)

assert.Equal(t, "generated_access_token", tokenResponse.AccessToken)
},
Expand Down Expand Up @@ -245,7 +246,11 @@ func TestUserRenewRefreshToken(t *testing.T) {
}

func getResponseStructFromResponseBody(responseBody *bytes.Buffer) (responseStruct response.Response, err error) {

data, err := io.ReadAll(responseBody)
json.Unmarshal(data, &responseStruct)
if err := json.Unmarshal(data, &responseStruct); err != nil {
return response.Response{}, nil
}

return
}
Empty file modified pkg/api/handler/cart.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/cart.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/order.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/product.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/interfaces/user.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/main_test.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/message.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/offer.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/order.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/payment_razorpay.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/payment_stripe.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/product.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/common.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/offer.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/order.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/pagination.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/product.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/request_params.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/request/user.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/coupons.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/order.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/product.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/response.go
100755 → 100644
Empty file.
Empty file modified pkg/api/handler/response/user.go
100755 → 100644
Empty file.
5 changes: 1 addition & 4 deletions pkg/api/handler/user.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ func (u *UserHandler) GetProfile(ctx *gin.Context) {
return
}

var data response.User
copier.Copy(&data, &user)

response.SuccessResponse(ctx, http.StatusOK, "Successfully retrieved user details", data)
response.SuccessResponse(ctx, http.StatusOK, "Successfully retrieved user details", user)
}

// UpdateProfile godoc
Expand Down
Empty file modified pkg/api/handler/wallet.go
100755 → 100644
Empty file.
8 changes: 4 additions & 4 deletions pkg/api/middleware/auth.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/nikhilnarayanan623/ecommerce-gin-clean-arch/pkg/service/token"
)

const (
authorizationHeaderKey string = "authorization"
authorizationType string = "bearer"
)
// const (
// authorizationHeaderKey string = "authorization"
// authorizationType string = "bearer"
// )

// Get User Auth middleware
func (c *middleware) AuthenticateUser() gin.HandlerFunc {
Expand Down
Empty file modified pkg/api/middleware/auth_test.go
100755 → 100644
Empty file.
Empty file modified pkg/api/middleware/main_test.go
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions pkg/api/middleware/trime_spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package middleware
import (
"bytes"
"encoding/json"
"io/ioutil"
"io"
"net/http"
"strings"

Expand All @@ -16,7 +16,7 @@ func (c *middleware) TrimSpaces() gin.HandlerFunc {

ctx.Request.Body = http.MaxBytesReader(ctx.Writer, ctx.Request.Body, int64(32<<20))

bodyBytes, err := ioutil.ReadAll(ctx.Request.Body)
bodyBytes, err := io.ReadAll(ctx.Request.Body)
if err != nil {
ctx.Abort()
response.ErrorResponse(ctx, http.StatusBadRequest, "failed to ready request body", err, nil)
Expand All @@ -25,7 +25,7 @@ func (c *middleware) TrimSpaces() gin.HandlerFunc {

bodyBytes = trimSpacesInJson(bodyBytes)

ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes))
ctx.Request.Body = io.NopCloser(bytes.NewReader(bodyBytes))
}
}

Expand Down
Empty file modified pkg/api/routes/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/api/routes/user.go
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions pkg/api/server.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewServerHTTP(authHandler handlerInterface.AuthHandler, middleware middlewa
return &ServerHTTP{Engine: engine}
}

func (s *ServerHTTP) Start() {
func (s *ServerHTTP) Start() error {

s.Engine.Run(":8000")
return s.Engine.Run(":8000")
}
11 changes: 8 additions & 3 deletions pkg/config/config.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Config struct {
GoauthCallbackUrl string `mapstructure:"GOAUTH_CALL_BACK_URL"`
}

// to hold all names of env variables
// name of envs and used to read from system envs
var envsNames = []string{
"ADMIN_EMAIL", "ADMIN_USER_NAME", "ADMIN_PASSWORD",
"DB_HOST", "DB_NAME", "DB_USER", "DB_PASSWORD", "DB_PORT", // database
Expand All @@ -50,11 +50,16 @@ var config Config

func LoadConfig() (Config, error) {

// set-up viper
// read from .env file
viper.AddConfigPath("./")
viper.SetConfigFile(".env")
viper.ReadInConfig()
err := viper.ReadInConfig()
// if there is no error means found .env file and read from it
if err == nil {
return config, nil
}

// if there is error then read envs from system environments
for _, env := range envsNames {
if err := viper.BindEnv(env); err != nil {
return config, err
Expand Down
9 changes: 7 additions & 2 deletions pkg/db/connection.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// func to connect data base using config(database config) and return address of a new instnce of gorm DB
func ConnectDatbase(cfg config.Config) (*gorm.DB, error) {
func ConnectDatabase(cfg config.Config) (*gorm.DB, error) {

dsn := fmt.Sprintf("host=%s user=%s dbname=%s port=%s password=%s", cfg.DBHost, cfg.DBUser, cfg.DBName, cfg.DBPort, cfg.DBPassword)

Expand All @@ -24,7 +24,7 @@ func ConnectDatbase(cfg config.Config) (*gorm.DB, error) {
}

// migrate the database tables
db.AutoMigrate(
err = db.AutoMigrate(

//auth
domain.RefreshSession{},
Expand Down Expand Up @@ -74,6 +74,11 @@ func ConnectDatbase(cfg config.Config) (*gorm.DB, error) {
domain.Transaction{},
)

if err != nil {
log.Printf("failed to migrate database models")
return nil, err
}

// setup the triggers
if err := SetUpDBTriggers(db); err != nil {
log.Printf("failed to setup database triggers")
Expand Down
20 changes: 10 additions & 10 deletions pkg/db/trigger.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@ func SetUpDBTriggers(db *gorm.DB) error {

// first execute the trigger funtion
if db.Exec(cartTotalPriceUpdateSqlFunc).Error != nil {
return errors.New("faild to execute cart_total_Pirce update trigger fun()")
return errors.New("failed to execute cart_total_price update trigger fun()")
}

// create trigger for calling the update funciton
if db.Exec(cartTotalPriceTriggerExec).Error != nil {
return errors.New("faild to create trigger for update total price on cart")
return errors.New("failed to create trigger for update total price on cart")
}

// update product_item qty on order time
if db.Exec(orderProductUpdateOnPlaceOrder).Error != nil {
return errors.New("faild to excute orderProductUpdate() trigger function")
return errors.New("failed to execute orderProductUpdate() trigger function")
}

if db.Exec(orderProductUpdateOnPlaceOrderTriggerExec).Error != nil {
return errors.New("faild to create orderProductUpdateTriggerExec trigger")
return errors.New("failed to create orderProductUpdateTriggerExec trigger")
}

//update product_item qty on order returned
if db.Exec(orderReturnProductUpdate).Error != nil {
return errors.New("faild to create orderReturnProductUpdate() trigger function")
return errors.New("failed to create orderReturnProductUpdate() trigger function")
}

if db.Exec(orderStatusFindFunc).Error != nil {
return errors.New("faild to create orderStatusFindFunc function for return order_status")
return errors.New("failed to create orderStatusFindFunc function for return order_status")
}

if db.Exec(orderReturnProductUpdateExec).Error != nil {
return errors.New("faild to create orderReturnProductUpdateExec trigger")
return errors.New("failed to create orderReturnProductUpdateExec trigger")
}

log.Printf("successfully trggers updated for databse")
log.Printf("successfully triggers updated for database")
return nil
}

var (
// function which return total price calculation on cart when product_item added or remove delete cart
// in here cheking first it delete any row from cart_item then take its cart_id an find all cart_items with this id and calculate total price and update it
// in here checking first it delete any row from cart_item then take its cart_id an find all cart_items with this id and calculate total price and update it
// cart with this cart_id
// any other like update or inset then take the cart_id and calculate the total price update on cart
cartTotalPriceUpdateSqlFunc = `CREATE OR REPLACE FUNCTION update_cart_total_price()
Expand Down Expand Up @@ -81,7 +81,7 @@ var (
AFTER INSERT OR UPDATE OR DELETE ON cart_items
FOR EACH ROW EXECUTE FUNCTION update_cart_total_price();`

//for updating product_item quntity when order place
//for updating product_item quantity when order place
orderProductUpdateOnPlaceOrder = `CREATE OR REPLACE FUNCTION update_product_quantity()
RETURNS TRIGGER AS $$
BEGIN
Expand Down
2 changes: 1 addition & 1 deletion pkg/di/wire.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

func InitializeApi(cfg config.Config) (*http.ServerHTTP, error) {

wire.Build(db.ConnectDatbase,
wire.Build(db.ConnectDatabase,
//external
token.NewTokenService,
otp.NewOtpAuth,
Expand Down
2 changes: 1 addition & 1 deletion pkg/di/wire_gen.go
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified pkg/domain/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/domain/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/domain/coupons.go
100755 → 100644
Empty file.
Empty file modified pkg/domain/order.go
100755 → 100644
Empty file.
Empty file modified pkg/domain/product.go
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion pkg/domain/user.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import "time"

type User struct {
ID uint `json:"id" gorm:"primaryKey;unique"`
Age uint `json:"age" binding:"required,numeric"`
GoogleImage string `json:"google_profile_image"`
FirstName string `json:"first_name" gorm:"not null" binding:"required,min=2,max=50"`
LastName string `json:"last_name" gorm:"not null" binding:"required,min=1,max=50"`
Age uint `json:"age" binding:"required,numeric"`
UserName string `json:"user_name" gorm:"not null;unique" binding:"required,min=3,max=15"`
Email string `json:"email" gorm:"unique;not null" binding:"required,email"`
Phone string `json:"phone" gorm:"unique" binding:"required,min=10,max=10"`
Expand Down
Empty file modified pkg/mock/mockrepo/auth_mock.go
100755 → 100644
Empty file.
Empty file modified pkg/mock/mockrepo/user_mock.go
100755 → 100644
Empty file.
Empty file modified pkg/mock/mockservice/token_mock.go
100755 → 100644
Empty file.
Empty file modified pkg/mock/mockusecase/auth_mock.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/auth_test.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/cart.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/cart.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/order.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/product.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/interfaces/user.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/offer.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/order.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/product.go
100755 → 100644
Empty file.
7 changes: 4 additions & 3 deletions pkg/repository/user.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ func (c *userDatabase) FindUserByUserNameEmailOrPhoneNotID(ctx context.Context,
func (c *userDatabase) SaveUser(ctx context.Context, user domain.User) (userID uint, err error) {

//save the user details
query := `INSERT INTO users (user_name, first_name, last_name, age, email, phone, password,created_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id`
query := `INSERT INTO users (user_name, first_name,
last_name, age, email, phone, password, google_image, created_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9 ) RETURNING id`

createdAt := time.Now()
err = c.DB.Raw(query, user.UserName, user.FirstName, user.LastName,
user.Age, user.Email, user.Phone, user.Password, createdAt).Scan(&user).Error
user.Age, user.Email, user.Phone, user.Password, user.GoogleImage, createdAt).Scan(&user).Error

return userID, err
}
Expand Down
Empty file modified pkg/repository/user_test.go
100755 → 100644
Empty file.
Empty file modified pkg/repository/wallet.go
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion pkg/service/otp/otp.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package otp

type OtpAuth interface {
SentOtp(phoneNumber string) (string, error)
VerifyOtp(phoneNumber string, code string) (valid bool,err error)
VerifyOtp(phoneNumber string, code string) (valid bool, err error)
}
Empty file modified pkg/service/otp/twilio.go
100755 → 100644
Empty file.
Empty file modified pkg/service/token/jwt.go
100755 → 100644
Empty file.
Empty file modified pkg/service/token/jwt_test.go
100755 → 100644
Empty file.
Empty file modified pkg/service/token/token.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/admin.go
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions pkg/usecase/auth.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,14 @@ func (c *authUseCase) GoogleLogin(ctx context.Context, user domain.User) (userID
if err != nil {
return userID, fmt.Errorf("failed to get user details with given email \nerror:%v", err.Error())
}

if existUser.ID != 0 {
return existUser.ID, nil
}

// create a random user name for user based on user name
user.UserName = utils.GenerateRandomUserName(user.FirstName)

userID, err = c.userRepo.SaveUser(ctx, user)
if err != nil {
return userID, fmt.Errorf("failed to save user details \nerror:%v", err.Error())
Expand Down
Empty file modified pkg/usecase/auth_test.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/cart.go
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions pkg/usecase/coupon.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ func (c *couponUseCase) ApplyCouponToCart(ctx context.Context, userID uint, coup
log.Printf("successfully updated the cart price with dicount price %d", discountAmount)
return discountAmount, nil
}

Empty file modified pkg/usecase/errors.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/admin.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/auth.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/cart.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/coupon.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/order.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/product.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/interfaces/user.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/offer.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/order.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/payment.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/product.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/user.go
100755 → 100644
Empty file.
Empty file modified pkg/usecase/wallet.go
100755 → 100644
Empty file.
Empty file modified pkg/utils/compare.go
100755 → 100644
Empty file.
Empty file modified pkg/utils/error.go
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions pkg/utils/helper_functions.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ func GenerateRandomUserName(FirstName string) string {
suffix := make([]byte, 4)

numbers := "1234567890"
rand.Seed(time.Now().UnixMilli())
seed := time.Now().UnixNano()
rng := rand.New(rand.NewSource(seed))

for i := range suffix {
suffix[i] = numbers[rand.Intn(10)]
suffix[i] = numbers[rng.Intn(10)]
}

userName := (FirstName + string(suffix))
Expand Down
Empty file modified pkg/utils/hsash.go
100755 → 100644
Empty file.
Empty file modified pkg/utils/log.go
100755 → 100644
Empty file.
Empty file modified pkg/utils/unique.go
100755 → 100644
Empty file.
Empty file modified postgres-kubernet.yaml
100755 → 100644
Empty file.
Empty file modified readme.md
100755 → 100644
Empty file.
Empty file modified views/goauth.html
100755 → 100644
Empty file.
Empty file modified views/paymentForm.html
100755 → 100644
Empty file.

0 comments on commit 36540c1

Please sign in to comment.