update
This commit is contained in:
parent
bd4223a58c
commit
eaccbd34e4
@ -4,9 +4,9 @@ import (
|
||||
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth"
|
||||
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
|
||||
"github.com/spf13/cobra"
|
||||
"go-template/pkg/protos/documentService"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
"leaf
|
||||
"net"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go-template/internal/migrations"
|
||||
"leafdev.top/Leaf/api-platform/internal/migrations"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"go-template/internal/base"
|
||||
"leafdev.top/Leaf/api-platform/internal/base"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
24
cmd/wire.go
24
cmd/wire.go
@ -4,18 +4,18 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"go-template/internal/base"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"go-template/internal/base/orm"
|
||||
"go-template/internal/base/redis"
|
||||
"go-template/internal/base/s3"
|
||||
"go-template/internal/base/server"
|
||||
"go-template/internal/batch"
|
||||
"go-template/internal/dao"
|
||||
"go-template/internal/handler"
|
||||
"go-template/internal/router"
|
||||
"go-template/internal/service"
|
||||
"leafdev.top/Leaf/api-platform/internal/base"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/orm"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/redis"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/s3"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/server"
|
||||
"leafdev.top/Leaf/api-platform/internal/batch"
|
||||
"leafdev.top/Leaf/api-platform/internal/dao"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler"
|
||||
"leafdev.top/Leaf/api-platform/internal/router"
|
||||
"leafdev.top/Leaf/api-platform/internal/service"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
@ -8,26 +8,26 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
"go-template/internal/base"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"go-template/internal/base/orm"
|
||||
"go-template/internal/base/redis"
|
||||
"go-template/internal/base/s3"
|
||||
"go-template/internal/base/server"
|
||||
"go-template/internal/batch"
|
||||
"go-template/internal/dao"
|
||||
"go-template/internal/handler"
|
||||
"go-template/internal/handler/grpc"
|
||||
"go-template/internal/handler/grpc/documents"
|
||||
"go-template/internal/handler/grpc/interceptor"
|
||||
"go-template/internal/handler/http"
|
||||
"go-template/internal/handler/http/controller/v1"
|
||||
"go-template/internal/router"
|
||||
"go-template/internal/service"
|
||||
"go-template/internal/service/auth"
|
||||
"go-template/internal/service/jwks"
|
||||
"go-template/internal/service/stream"
|
||||
"leafdev.top/Leaf/api-platform/internal/base"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/orm"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/redis"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/s3"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/server"
|
||||
"leafdev.top/Leaf/api-platform/internal/batch"
|
||||
"leafdev.top/Leaf/api-platform/internal/dao"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc/documents"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc/interceptor"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http/controller/v1"
|
||||
"leafdev.top/Leaf/api-platform/internal/router"
|
||||
"leafdev.top/Leaf/api-platform/internal/service"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/jwks"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/stream"
|
||||
)
|
||||
|
||||
// Injectors from wire.go:
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go-template/internal/entity"
|
||||
"leafdev.top/Leaf/api-platform/internal/entity"
|
||||
|
||||
"gorm.io/gen"
|
||||
)
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const frameworkModuleName = "leafdev.top/ecosystem/billing"
|
||||
const frameworkModuleName = "leafdev.top/Leaf/api-platform"
|
||||
|
||||
func main() {
|
||||
// 输入新的 go.mod module
|
||||
|
@ -1,16 +1,17 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"go-template/internal/base/redis"
|
||||
"go-template/internal/base/s3"
|
||||
"go-template/internal/base/server"
|
||||
"go-template/internal/batch"
|
||||
"go-template/internal/dao"
|
||||
"go-template/internal/handler"
|
||||
"go-template/internal/handler/http"
|
||||
"go-template/internal/service"
|
||||
"gorm.io/gorm"
|
||||
"leafdev.top/Leaf/api-platform/int
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/redis"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/s3"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/server"
|
||||
"leafdev.top/Leaf/api-platform/internal/batch"
|
||||
"leafdev.top/Leaf/api-platform/internal/dao"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"go-template/configs"
|
||||
"leafdev.top/Leaf/api-platform/configs"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"go-template/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -2,8 +2,9 @@ package orm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"gorm.io/driver/postgres"
|
||||
"leafdev.top/Leaf/api-p
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"gorm.io/driver/postgres"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
@ -3,7 +3,7 @@ package redis
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go-template/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
|
||||
"github.com/bsm/redislock"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package s3
|
||||
|
||||
import (
|
||||
"go-template/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
|
@ -4,11 +4,11 @@ import (
|
||||
"github.com/labstack/echo-contrib/echoprometheus"
|
||||
"github.com/labstack/echo/v4"
|
||||
echoMiddleware "github.com/labstack/echo/v4/middleware"
|
||||
"go-template/internal/base/conf"
|
||||
httpHandlers "go-template/internal/handler/http"
|
||||
"go-template/internal/handler/http/response"
|
||||
"go-template/internal/router"
|
||||
"go-template/pkg/consts"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
httpHandlers "leafdev.top/Leaf/api-platform/internal/handler/http"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http/response"
|
||||
"leafdev.top/Leaf/api-platform/internal/router"
|
||||
"leafdev.top/Leaf/api-platform/pkg/consts"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package batch
|
||||
|
||||
import (
|
||||
"go-template/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
)
|
||||
|
||||
type Batch struct {
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"go-template/internal/entity"
|
||||
"leafdev.top/Leaf/api-platform/internal/entity"
|
||||
)
|
||||
|
||||
func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"go-template/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -2,7 +2,7 @@ package documents
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go-template/pkg/protos/documentService"
|
||||
"leafdev.top/Leaf/api-platform/pkg/protos/documentService"
|
||||
)
|
||||
|
||||
func (d *DocumentService) ListDocuments(ctx context.Context, req *documentService.ListDocumentsRequest) (*documentService.ListDocumentsResponse, error) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package documents
|
||||
|
||||
import (
|
||||
"go-template/internal/dao"
|
||||
"go-template/pkg/protos/documentService"
|
||||
"leafdev.top/Leaf/api-platform/internal/dao"
|
||||
"leafdev.top/Leaf/api-platform/pkg/protos/documentService"
|
||||
)
|
||||
|
||||
type DocumentService struct {
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth"
|
||||
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
|
||||
"go-template/internal/schema"
|
||||
auth2 "go-template/internal/service/auth"
|
||||
"go-template/pkg/consts"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
auth2 "leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/pkg/consts"
|
||||
)
|
||||
|
||||
type Auth struct {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
|
||||
"go-template/internal/base/logger"
|
||||
"go.uber.org/zap"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
)
|
||||
|
||||
type Logger struct {
|
||||
|
@ -2,8 +2,8 @@ package grpc
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
"go-template/internal/handler/grpc/documents"
|
||||
"go-template/internal/handler/grpc/interceptor"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc/documents"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc/interceptor"
|
||||
)
|
||||
|
||||
var ProviderSet = wire.NewSet(
|
||||
|
@ -2,8 +2,8 @@ package handler
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
"go-template/internal/handler/grpc"
|
||||
"go-template/internal/handler/http"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/grpc"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http"
|
||||
)
|
||||
|
||||
var ProviderSet = wire.NewSet(
|
||||
|
@ -2,9 +2,9 @@ package v1
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"go-template/internal/handler/http/response"
|
||||
"go-template/internal/schema"
|
||||
"go-template/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http/response"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -2,11 +2,11 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/handler/http/response"
|
||||
"go-template/internal/schema"
|
||||
"go-template/internal/service/auth"
|
||||
"go-template/pkg/consts"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http/response"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/pkg/consts"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
|
@ -3,11 +3,11 @@ package http
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
"github.com/labstack/echo/v4"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
v1 "go-template/internal/handler/http/controller/v1"
|
||||
"go-template/internal/handler/http/middleware"
|
||||
"go-template/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
v1 "leafdev.top/Leaf/api-platform/internal/handler/http/controller/v1"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http/middleware"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
)
|
||||
|
||||
type IMiddleware interface {
|
||||
|
@ -2,7 +2,7 @@ package migrations
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"go-template/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
)
|
||||
|
||||
//go:embed *.sql
|
||||
|
@ -2,7 +2,7 @@ package router
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"go-template/internal/handler/http"
|
||||
"leafdev.top/Leaf/api-platform/internal/handler/http"
|
||||
)
|
||||
|
||||
// 两种方法都可以
|
||||
|
@ -2,7 +2,7 @@ package router
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
_ "go-template/docs"
|
||||
_ "leafdev.top/Leaf/api-platform/docs"
|
||||
|
||||
echoSwagger "github.com/swaggo/echo-swagger"
|
||||
)
|
||||
|
@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"go-template/internal/schema"
|
||||
"go-template/internal/service/jwks"
|
||||
"go-template/pkg/consts"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/jwks"
|
||||
"leafdev.top/Leaf/api-platform/pkg/consts"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
|
@ -2,8 +2,8 @@ package jwks
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-template/internal/base/conf"
|
||||
"go-template/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
|
||||
"github.com/MicahParks/keyfunc/v3"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
|
@ -1,10 +1,10 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"go-template/internal/base/logger"
|
||||
"go-template/internal/service/auth"
|
||||
"go-template/internal/service/jwks"
|
||||
"go-template/internal/service/stream"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/logger"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/auth"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/jwks"
|
||||
"leafdev.top/Leaf/api-platform/internal/service/stream"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package stream
|
||||
import (
|
||||
"context"
|
||||
"github.com/segmentio/kafka-go"
|
||||
"go-template/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package stream
|
||||
|
||||
import (
|
||||
"go-template/internal/base/conf"
|
||||
"leafdev.top/Leaf/api-platform/internal/base/conf"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
|
2
main.go
2
main.go
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go-template/cmd"
|
||||
"leafdev.top/Leaf/api-platform/cmd"
|
||||
)
|
||||
|
||||
// @title API Docs
|
||||
|
@ -2,7 +2,7 @@ package consts
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-template/internal/schema"
|
||||
"leafdev.top/Leaf/api-platform/internal/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1,6 +1,6 @@
|
||||
package consts
|
||||
|
||||
import "go-template/internal/schema"
|
||||
import "leafdev.top/Leaf/api-platform/internal/schema"
|
||||
|
||||
const (
|
||||
RoleSuperAdmin schema.UserRole = "super-admin"
|
||||
|
Loading…
Reference in New Issue
Block a user