Skip to content

Instantly share code, notes, and snippets.

View solrac97gr's full-sized avatar
:shipit:
Working from Home!

Carlos García Rosales solrac97gr

:shipit:
Working from Home!
View GitHub Profile
package main
import (
"fmt"
"math"
)
type Point struct {
X, Y float64
}
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"errors"
"fmt"
use std::fs;
use std::path::Path;
use std::env;
extern crate dotenv;
fn main() {
@solrac97gr
solrac97gr / main.go
Last active November 15, 2021 12:55
package main
import (
"goHexagonalBlog/internal/core/services"
"goHexagonalBlog/internal/handlers"
"goHexagonalBlog/internal/repositories"
"goHexagonalBlog/internal/server"
)
func main() {
package server
import (
"goHexagonalBlog/internal/core/ports"
"log"
fiber "github.com/gofiber/fiber/v2"
)
type Server struct {
package handlers
import (
"goHexagonalBlog/internal/core/ports"
fiber "github.com/gofiber/fiber/v2"
)
type UserHandlers struct {
userService ports.UserService
package repositories
import (
"context"
"time"
"goHexagonalBlog/internal/core/ports"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
package services
import (
"errors"
"goHexagonalBlog/internal/core/ports"
)
type UserService struct {
userRepository ports.UserRepository
}
package ports
import (
fiber "github.com/gofiber/fiber/v2"
)
type UserService interface {
Login(email string, password string) error
Register(email string, password string, passwordConfirmation string) error
}
package domain
type User struct {
ID int
Email string
Password string
}
func NewPerson(id int, email string, password string) *User {
return &User{