feat: add feature based structure

This commit is contained in:
Justin Lin
2025-08-26 19:18:35 +10:00
commit d963362711
15 changed files with 436 additions and 0 deletions

34
cmd/api/main.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import (
"context"
"log"
"github.com/gin-gonic/gin"
"github.com/jackc/pgx/v5"
user "tutorial.sqlc.dev/app/internal/author"
)
func run() error {
ctx := context.Background()
conn, err := pgx.Connect(ctx, "postgres://postgres:supersecretpassword@localhost:5432/sqlc_tutorial")
if err != nil {
return err
}
defer conn.Close(ctx)
r := gin.Default()
userCtl := user.NewController(conn)
user.Register(r, &userCtl)
r.Run(":8000")
return nil
}
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}