This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"github.com/golang-jwt/jwt" | |
"log" | |
"net/http" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"golang.org/x/oauth2" | |
"golang.org/x/oauth2/github" | |
"io" | |
"net/http" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"Go-Tutorials/models" | |
"github.com/gin-gonic/gin" | |
"net/http" | |
) | |
type CreateBookInput struct { | |
Title string `json:"title" binding:"required"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/gin-gonic/gin" | |
"gorm.io/driver/sqlite" | |
"gorm.io/gorm" | |
"log" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"golang.org/x/oauth2" | |
"io" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In this script, we'll create a function to generate secure random strings. | |
// First, define the function that generates the random string. | |
func generateRandomString(chars string, length int) string { | |
// Create an array of bytes with the specified length. | |
bytes := make([]byte, length) | |
// Use crypto/rand to fill the byte array with secure random bytes. | |
_, err := rand.Read(bytes) | |
if err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build stage | |
FROM golang:1.20-alpine AS build | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Copy the Go application source code into the container | |
COPY . . | |
# Build the Go application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"gorm.io/driver/postgres" | |
"gorm.io/gorm" | |
"gorm.io/gorm/schema" | |
"log" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/brianvoe/gofakeit/v6" | |
"gorm.io/driver/postgres" | |
"gorm.io/gorm" | |
"log" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git add . | |
echo -n "🔊 What's the commit message 👉 " | |
read response | |
git commit -m "$response" | |
git push origin main |
NewerOlder