feat: complete template

This commit is contained in:
Rogee
2024-11-29 17:05:05 +08:00
parent aa7ad01ecc
commit 7bc082abea
36 changed files with 1336 additions and 252 deletions

View File

@@ -1,9 +1,9 @@
gen:
model:
dsn: __DSN
dsn: "postgres://postgres:xixi0202@10.1.1.3:5432/qvyun?sslmode=disable"
source: postgres
schema: public
path: ./database
path: ./database/models
ignores: [] # ignore tables
types:
kube_pods: # table name

View File

@@ -1,42 +1,56 @@
package http
import (
"backend/modules/users"
"backend/providers/app"
"backend/providers/http/fiber"
"backend/providers/http"
"backend/providers/postgres"
"git.ipao.vip/rogeecn/atom"
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/contracts"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"go.uber.org/dig"
)
func Default(providers ...container.ProviderContainer) container.Providers {
func defaultProviders(providers ...container.ProviderContainer) container.Providers {
return append(container.Providers{
app.DefaultProvider(),
fiber.DefaultProvider(),
http.DefaultProvider(),
postgres.DefaultProvider(),
}, providers...)
}
func Command() atom.Option {
providers := defaultProviders().With(
users.Provide,
)
return atom.Command(
atom.Name("serve"),
atom.Short("run http server"),
atom.RunE(Serve),
atom.Providers(Default()),
atom.Providers(providers),
)
}
type Http struct {
dig.In
Service contracts.HttpService
Service *http.Service
Initials []contracts.Initial `group:"initials"`
Routes []contracts.HttpRoute `group:"routes"`
}
func Serve(cmd *cobra.Command, args []string) error {
return container.Container.Invoke(func(http Http) error {
for _, route := range http.Routes {
if err := route.Register(); err != nil {
log.Fatal(err)
}
}
return http.Service.Serve()
})
}

View File

@@ -0,0 +1,101 @@
package http
import (
"backend/providers/wechat"
"github.com/gofiber/fiber/v3"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
type Middlewares struct {
client *wechat.Client
}
func Init(client *wechat.Client) *Middlewares {
return &Middlewares{
client: client,
}
}
func (f *Middlewares) Verify(c fiber.Ctx) error {
// get the query parameters
signature := c.Query("signature")
timestamp := c.Query("timestamp")
nonce := c.Query("nonce")
echostr := c.Query("echostr")
if signature == "" || timestamp == "" || nonce == "" || echostr == "" {
return c.Next()
}
log.Infof(
"begin verify signature, signature: %s, timestamp: %s, nonce: %s, echostr: %s",
signature,
timestamp,
nonce,
echostr,
)
// verify the signature
if err := f.client.Verify(signature, timestamp, nonce); err != nil {
return c.SendString(err.Error())
}
return c.SendString(echostr)
}
func (f *Middlewares) SilentAuth(c fiber.Ctx) error {
// if cookie not exists key "openid", then redirect to the wechat auth page
sid := c.Cookies("sid", "")
if sid != "" {
// TODO: verify sid
return c.Next()
}
// get current full url
url := c.BaseURL()
url = "https://qvyun.mp.jdwan.com"
log.WithField("module", "middleware.SilentAuth").Debug("url:", url)
to, err := f.client.ScopeAuthorizeURL(
wechat.ScopeAuthorizeURLWithRedirectURI(url),
wechat.ScopeAuthorizeURLWithState("sns_basic_auth"),
)
if err != nil {
return errors.Wrap(err, "failed to get wechat auth url")
}
log.WithField("module", "middleware.SilentAuth").Debug("redirectTo: ", to.String())
return c.Redirect().To(to.String())
}
func (f *Middlewares) AuthUserInfo(c fiber.Ctx) error {
state := c.Query("state")
code := c.Query("code")
if state == "" && code == "" {
return c.Next()
}
if state != "sns_basic_auth" {
return c.Next()
}
log.WithField("module", "middleware.AuthUserInfo").Debug("code", code)
// get the openid
token, err := f.client.AuthorizeCode2Token(code)
if err != nil {
return errors.Wrap(err, "failed to get openid")
}
// TODO: store the openid to the session
// set the openid to the cookie
c.Cookie(&fiber.Cookie{
Name: "sid",
Value: token.Openid,
HTTPOnly: true,
})
return c.Redirect().To("/")
}

View File

@@ -0,0 +1,23 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type MediaResources struct {
ID int64 `sql:"primary_key"`
MediaID int64
Type string
Source *string
Size int64
Publish bool
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,24 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type Medias struct {
ID int64 `sql:"primary_key"`
TenantID int64
Title string
Description string
Price int64
Discount int64
Publish bool
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,19 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type Migrations struct {
ID int32 `sql:"primary_key"`
VersionID int64
IsApplied bool
Tstamp time.Time
}

View File

@@ -0,0 +1,15 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
type TenantUserBalances struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
Balance int64
}

View File

@@ -0,0 +1,22 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type Tenants struct {
ID int64 `sql:"primary_key"`
Name string
Slug string
Description *string
ExpireAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,22 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type UserBalanceHistories struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
Balance int64
Target *string
Type string
CreatedAt time.Time
}

View File

@@ -0,0 +1,21 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type UserMedias struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
MediaID int64
Price int64
CreatedAt time.Time
}

View File

@@ -0,0 +1,22 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type Users struct {
ID int64 `sql:"primary_key"`
OpenID string
UnionID *string
OAuth *string
ExpireIn time.Time
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,19 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
import (
"time"
)
type UsersTenants struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
CreatedAt time.Time
}

View File

@@ -0,0 +1,96 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var MediaResources = newMediaResourcesTable("public", "media_resources", "")
type mediaResourcesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
MediaID postgres.ColumnInteger
Type postgres.ColumnString
Source postgres.ColumnString
Size postgres.ColumnInteger
Publish postgres.ColumnBool
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type MediaResourcesTable struct {
mediaResourcesTable
EXCLUDED mediaResourcesTable
}
// AS creates new MediaResourcesTable with assigned alias
func (a MediaResourcesTable) AS(alias string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new MediaResourcesTable with assigned schema name
func (a MediaResourcesTable) FromSchema(schemaName string) *MediaResourcesTable {
return newMediaResourcesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new MediaResourcesTable with assigned table prefix
func (a MediaResourcesTable) WithPrefix(prefix string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new MediaResourcesTable with assigned table suffix
func (a MediaResourcesTable) WithSuffix(suffix string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newMediaResourcesTable(schemaName, tableName, alias string) *MediaResourcesTable {
return &MediaResourcesTable{
mediaResourcesTable: newMediaResourcesTableImpl(schemaName, tableName, alias),
EXCLUDED: newMediaResourcesTableImpl("", "excluded", ""),
}
}
func newMediaResourcesTableImpl(schemaName, tableName, alias string) mediaResourcesTable {
var (
IDColumn = postgres.IntegerColumn("id")
MediaIDColumn = postgres.IntegerColumn("media_id")
TypeColumn = postgres.StringColumn("type")
SourceColumn = postgres.StringColumn("source")
SizeColumn = postgres.IntegerColumn("size")
PublishColumn = postgres.BoolColumn("publish")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, MediaIDColumn, TypeColumn, SourceColumn, SizeColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{MediaIDColumn, TypeColumn, SourceColumn, SizeColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
)
return mediaResourcesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
MediaID: MediaIDColumn,
Type: TypeColumn,
Source: SourceColumn,
Size: SizeColumn,
Publish: PublishColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,99 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var Medias = newMediasTable("public", "medias", "")
type mediasTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
TenantID postgres.ColumnInteger
Title postgres.ColumnString
Description postgres.ColumnString
Price postgres.ColumnInteger
Discount postgres.ColumnInteger
Publish postgres.ColumnBool
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type MediasTable struct {
mediasTable
EXCLUDED mediasTable
}
// AS creates new MediasTable with assigned alias
func (a MediasTable) AS(alias string) *MediasTable {
return newMediasTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new MediasTable with assigned schema name
func (a MediasTable) FromSchema(schemaName string) *MediasTable {
return newMediasTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new MediasTable with assigned table prefix
func (a MediasTable) WithPrefix(prefix string) *MediasTable {
return newMediasTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new MediasTable with assigned table suffix
func (a MediasTable) WithSuffix(suffix string) *MediasTable {
return newMediasTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newMediasTable(schemaName, tableName, alias string) *MediasTable {
return &MediasTable{
mediasTable: newMediasTableImpl(schemaName, tableName, alias),
EXCLUDED: newMediasTableImpl("", "excluded", ""),
}
}
func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
var (
IDColumn = postgres.IntegerColumn("id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
TitleColumn = postgres.StringColumn("title")
DescriptionColumn = postgres.StringColumn("description")
PriceColumn = postgres.IntegerColumn("price")
DiscountColumn = postgres.IntegerColumn("discount")
PublishColumn = postgres.BoolColumn("publish")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
)
return mediasTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
TenantID: TenantIDColumn,
Title: TitleColumn,
Description: DescriptionColumn,
Price: PriceColumn,
Discount: DiscountColumn,
Publish: PublishColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,84 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var Migrations = newMigrationsTable("public", "migrations", "")
type migrationsTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
VersionID postgres.ColumnInteger
IsApplied postgres.ColumnBool
Tstamp postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type MigrationsTable struct {
migrationsTable
EXCLUDED migrationsTable
}
// AS creates new MigrationsTable with assigned alias
func (a MigrationsTable) AS(alias string) *MigrationsTable {
return newMigrationsTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new MigrationsTable with assigned schema name
func (a MigrationsTable) FromSchema(schemaName string) *MigrationsTable {
return newMigrationsTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new MigrationsTable with assigned table prefix
func (a MigrationsTable) WithPrefix(prefix string) *MigrationsTable {
return newMigrationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new MigrationsTable with assigned table suffix
func (a MigrationsTable) WithSuffix(suffix string) *MigrationsTable {
return newMigrationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newMigrationsTable(schemaName, tableName, alias string) *MigrationsTable {
return &MigrationsTable{
migrationsTable: newMigrationsTableImpl(schemaName, tableName, alias),
EXCLUDED: newMigrationsTableImpl("", "excluded", ""),
}
}
func newMigrationsTableImpl(schemaName, tableName, alias string) migrationsTable {
var (
IDColumn = postgres.IntegerColumn("id")
VersionIDColumn = postgres.IntegerColumn("version_id")
IsAppliedColumn = postgres.BoolColumn("is_applied")
TstampColumn = postgres.TimestampColumn("tstamp")
allColumns = postgres.ColumnList{IDColumn, VersionIDColumn, IsAppliedColumn, TstampColumn}
mutableColumns = postgres.ColumnList{VersionIDColumn, IsAppliedColumn, TstampColumn}
)
return migrationsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
VersionID: VersionIDColumn,
IsApplied: IsAppliedColumn,
Tstamp: TstampColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,22 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
// this method only once at the beginning of the program.
func UseSchema(schema string) {
MediaResources = MediaResources.FromSchema(schema)
Medias = Medias.FromSchema(schema)
Migrations = Migrations.FromSchema(schema)
TenantUserBalances = TenantUserBalances.FromSchema(schema)
Tenants = Tenants.FromSchema(schema)
UserBalanceHistories = UserBalanceHistories.FromSchema(schema)
UserMedias = UserMedias.FromSchema(schema)
Users = Users.FromSchema(schema)
UsersTenants = UsersTenants.FromSchema(schema)
}

View File

@@ -0,0 +1,84 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var TenantUserBalances = newTenantUserBalancesTable("public", "tenant_user_balances", "")
type tenantUserBalancesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
Balance postgres.ColumnInteger
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type TenantUserBalancesTable struct {
tenantUserBalancesTable
EXCLUDED tenantUserBalancesTable
}
// AS creates new TenantUserBalancesTable with assigned alias
func (a TenantUserBalancesTable) AS(alias string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new TenantUserBalancesTable with assigned schema name
func (a TenantUserBalancesTable) FromSchema(schemaName string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new TenantUserBalancesTable with assigned table prefix
func (a TenantUserBalancesTable) WithPrefix(prefix string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new TenantUserBalancesTable with assigned table suffix
func (a TenantUserBalancesTable) WithSuffix(suffix string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newTenantUserBalancesTable(schemaName, tableName, alias string) *TenantUserBalancesTable {
return &TenantUserBalancesTable{
tenantUserBalancesTable: newTenantUserBalancesTableImpl(schemaName, tableName, alias),
EXCLUDED: newTenantUserBalancesTableImpl("", "excluded", ""),
}
}
func newTenantUserBalancesTableImpl(schemaName, tableName, alias string) tenantUserBalancesTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
BalanceColumn = postgres.IntegerColumn("balance")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, BalanceColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, BalanceColumn}
)
return tenantUserBalancesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
Balance: BalanceColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var Tenants = newTenantsTable("public", "tenants", "")
type tenantsTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
Name postgres.ColumnString
Slug postgres.ColumnString
Description postgres.ColumnString
ExpireAt postgres.ColumnTimestamp
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type TenantsTable struct {
tenantsTable
EXCLUDED tenantsTable
}
// AS creates new TenantsTable with assigned alias
func (a TenantsTable) AS(alias string) *TenantsTable {
return newTenantsTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new TenantsTable with assigned schema name
func (a TenantsTable) FromSchema(schemaName string) *TenantsTable {
return newTenantsTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new TenantsTable with assigned table prefix
func (a TenantsTable) WithPrefix(prefix string) *TenantsTable {
return newTenantsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new TenantsTable with assigned table suffix
func (a TenantsTable) WithSuffix(suffix string) *TenantsTable {
return newTenantsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newTenantsTable(schemaName, tableName, alias string) *TenantsTable {
return &TenantsTable{
tenantsTable: newTenantsTableImpl(schemaName, tableName, alias),
EXCLUDED: newTenantsTableImpl("", "excluded", ""),
}
}
func newTenantsTableImpl(schemaName, tableName, alias string) tenantsTable {
var (
IDColumn = postgres.IntegerColumn("id")
NameColumn = postgres.StringColumn("name")
SlugColumn = postgres.StringColumn("slug")
DescriptionColumn = postgres.StringColumn("description")
ExpireAtColumn = postgres.TimestampColumn("expire_at")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, NameColumn, SlugColumn, DescriptionColumn, ExpireAtColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, SlugColumn, DescriptionColumn, ExpireAtColumn, CreatedAtColumn, UpdatedAtColumn}
)
return tenantsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
Name: NameColumn,
Slug: SlugColumn,
Description: DescriptionColumn,
ExpireAt: ExpireAtColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var UserBalanceHistories = newUserBalanceHistoriesTable("public", "user_balance_histories", "")
type userBalanceHistoriesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
Balance postgres.ColumnInteger
Target postgres.ColumnString
Type postgres.ColumnString
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UserBalanceHistoriesTable struct {
userBalanceHistoriesTable
EXCLUDED userBalanceHistoriesTable
}
// AS creates new UserBalanceHistoriesTable with assigned alias
func (a UserBalanceHistoriesTable) AS(alias string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UserBalanceHistoriesTable with assigned schema name
func (a UserBalanceHistoriesTable) FromSchema(schemaName string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UserBalanceHistoriesTable with assigned table prefix
func (a UserBalanceHistoriesTable) WithPrefix(prefix string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UserBalanceHistoriesTable with assigned table suffix
func (a UserBalanceHistoriesTable) WithSuffix(suffix string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUserBalanceHistoriesTable(schemaName, tableName, alias string) *UserBalanceHistoriesTable {
return &UserBalanceHistoriesTable{
userBalanceHistoriesTable: newUserBalanceHistoriesTableImpl(schemaName, tableName, alias),
EXCLUDED: newUserBalanceHistoriesTableImpl("", "excluded", ""),
}
}
func newUserBalanceHistoriesTableImpl(schemaName, tableName, alias string) userBalanceHistoriesTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
BalanceColumn = postgres.IntegerColumn("balance")
TargetColumn = postgres.StringColumn("target")
TypeColumn = postgres.StringColumn("type")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, BalanceColumn, TargetColumn, TypeColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, BalanceColumn, TargetColumn, TypeColumn, CreatedAtColumn}
)
return userBalanceHistoriesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
Balance: BalanceColumn,
Target: TargetColumn,
Type: TypeColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,90 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var UserMedias = newUserMediasTable("public", "user_medias", "")
type userMediasTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
MediaID postgres.ColumnInteger
Price postgres.ColumnInteger
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UserMediasTable struct {
userMediasTable
EXCLUDED userMediasTable
}
// AS creates new UserMediasTable with assigned alias
func (a UserMediasTable) AS(alias string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UserMediasTable with assigned schema name
func (a UserMediasTable) FromSchema(schemaName string) *UserMediasTable {
return newUserMediasTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UserMediasTable with assigned table prefix
func (a UserMediasTable) WithPrefix(prefix string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UserMediasTable with assigned table suffix
func (a UserMediasTable) WithSuffix(suffix string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUserMediasTable(schemaName, tableName, alias string) *UserMediasTable {
return &UserMediasTable{
userMediasTable: newUserMediasTableImpl(schemaName, tableName, alias),
EXCLUDED: newUserMediasTableImpl("", "excluded", ""),
}
}
func newUserMediasTableImpl(schemaName, tableName, alias string) userMediasTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
MediaIDColumn = postgres.IntegerColumn("media_id")
PriceColumn = postgres.IntegerColumn("price")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, MediaIDColumn, PriceColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, MediaIDColumn, PriceColumn, CreatedAtColumn}
)
return userMediasTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
MediaID: MediaIDColumn,
Price: PriceColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var Users = newUsersTable("public", "users", "")
type usersTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
OpenID postgres.ColumnString
UnionID postgres.ColumnString
OAuth postgres.ColumnString
ExpireIn postgres.ColumnTimestamp
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UsersTable struct {
usersTable
EXCLUDED usersTable
}
// AS creates new UsersTable with assigned alias
func (a UsersTable) AS(alias string) *UsersTable {
return newUsersTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UsersTable with assigned schema name
func (a UsersTable) FromSchema(schemaName string) *UsersTable {
return newUsersTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UsersTable with assigned table prefix
func (a UsersTable) WithPrefix(prefix string) *UsersTable {
return newUsersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UsersTable with assigned table suffix
func (a UsersTable) WithSuffix(suffix string) *UsersTable {
return newUsersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUsersTable(schemaName, tableName, alias string) *UsersTable {
return &UsersTable{
usersTable: newUsersTableImpl(schemaName, tableName, alias),
EXCLUDED: newUsersTableImpl("", "excluded", ""),
}
}
func newUsersTableImpl(schemaName, tableName, alias string) usersTable {
var (
IDColumn = postgres.IntegerColumn("id")
OpenIDColumn = postgres.StringColumn("open_id")
UnionIDColumn = postgres.StringColumn("union_id")
OAuthColumn = postgres.StringColumn("oauth")
ExpireInColumn = postgres.TimestampColumn("expire_in")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, OpenIDColumn, UnionIDColumn, OAuthColumn, ExpireInColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{OpenIDColumn, UnionIDColumn, OAuthColumn, ExpireInColumn, CreatedAtColumn, UpdatedAtColumn}
)
return usersTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
OpenID: OpenIDColumn,
UnionID: UnionIDColumn,
OAuth: OAuthColumn,
ExpireIn: ExpireInColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,84 @@
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package table
import (
"github.com/go-jet/jet/v2/postgres"
)
var UsersTenants = newUsersTenantsTable("public", "users_tenants", "")
type usersTenantsTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UsersTenantsTable struct {
usersTenantsTable
EXCLUDED usersTenantsTable
}
// AS creates new UsersTenantsTable with assigned alias
func (a UsersTenantsTable) AS(alias string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UsersTenantsTable with assigned schema name
func (a UsersTenantsTable) FromSchema(schemaName string) *UsersTenantsTable {
return newUsersTenantsTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UsersTenantsTable with assigned table prefix
func (a UsersTenantsTable) WithPrefix(prefix string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UsersTenantsTable with assigned table suffix
func (a UsersTenantsTable) WithSuffix(suffix string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUsersTenantsTable(schemaName, tableName, alias string) *UsersTenantsTable {
return &UsersTenantsTable{
usersTenantsTable: newUsersTenantsTableImpl(schemaName, tableName, alias),
EXCLUDED: newUsersTenantsTableImpl("", "excluded", ""),
}
}
func newUsersTenantsTableImpl(schemaName, tableName, alias string) usersTenantsTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, CreatedAtColumn}
)
return usersTenantsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,17 @@
package services
import (
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func() (*User, error) {
obj := &User{}
return obj, nil
}); err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,10 @@
package services
import "context"
// @provider
type User struct{}
func (u *User) Get(ctx context.Context) string {
return "User"
}

View File

@@ -4,8 +4,7 @@ go 1.22.0
require (
git.ipao.vip/rogeecn/atom v1.0.10
github.com/evanphx/json-patch v0.5.2
github.com/gofiber/fiber/v2 v2.52.5
github.com/go-jet/jet/v2 v2.12.0
github.com/gofiber/fiber/v3 v3.0.0-beta.3
github.com/gofrs/uuid v4.4.0+incompatible
github.com/golang-jwt/jwt/v4 v4.5.1
@@ -19,8 +18,6 @@ require (
github.com/smartystreets/goconvey v1.6.4
github.com/speps/go-hashids/v2 v2.0.1
github.com/spf13/cobra v1.8.1
github.com/swaggo/fiber-swagger v1.3.0
github.com/swaggo/swag v1.16.4
go.uber.org/dig v1.18.0
golang.org/x/net v0.31.0
golang.org/x/sync v0.9.0
@@ -28,16 +25,10 @@ require (
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/cloudflare/circl v1.4.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gofiber/utils/v2 v2.0.0-beta.4 // indirect
github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134 // indirect
@@ -47,22 +38,19 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/onsi/ginkgo/v2 v2.20.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.47.0 // indirect
github.com/refraction-networking/utls v1.6.7 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogeecn/atom v1.0.8 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
@@ -74,8 +62,8 @@ require (
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.17.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
@@ -89,6 +77,5 @@ require (
golang.org/x/tools v0.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@@ -40,14 +40,6 @@ git.ipao.vip/rogeecn/atom v1.0.10 h1:U/10G17rkULOAhgqGUD6rhcdJ5vJNxGv5gelAZTcJeU
git.ipao.vip/rogeecn/atom v1.0.10/go.mod h1:YY1nlkYnMpZxen5R64mblMWm+LJYyvWiw3P8P2eO7dY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -60,9 +52,7 @@ github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZ
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -75,34 +65,20 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k=
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jet/jet/v2 v2.12.0 h1:z2JfvBAZgsfxlQz6NXBYdZTXc7ep3jhbszTLtETv1JE=
github.com/go-jet/jet/v2 v2.12.0/go.mod h1:ufQVRQeI1mbcO5R8uCEVcVf3Foej9kReBdwDx7YMWUM=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/gofiber/fiber/v2 v2.32.0/go.mod h1:CMy5ZLiXkn6qwthrl03YMyW1NLfj0rhxz2LKl4t7ZTY=
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/gofiber/fiber/v3 v3.0.0-beta.3 h1:7Q2I+HsIqnIEEDB+9oe7Gadpakh6ZLhXpTYz/L20vrg=
github.com/gofiber/fiber/v3 v3.0.0-beta.3/go.mod h1:kcMur0Dxqk91R7p4vxEpJfDWZ9u5IfvrtQc8Bvv/JmY=
github.com/gofiber/utils/v2 v2.0.0-beta.4 h1:1gjbVFFwVwUb9arPcqiB6iEjHBwo7cHsyS41NeIW3co=
@@ -192,9 +168,6 @@ github.com/imroc/req/v3 v3.48.0 h1:IYuMGetuwLzOOTzDCquDqs912WNwpsPK0TBXWPIvoqg=
github.com/imroc/req/v3 v3.48.0/go.mod h1:weam9gmyb00QnOtu6HXSnk44dNFkIUQb5QdMx13FeUU=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
@@ -202,7 +175,6 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV
github.com/juju/go4 v0.0.0-20160222163258-40d72ab9641a h1:45JtCyuNYE+QN9aPuR1ID9++BQU+NMTMudHSuaK0Las=
github.com/juju/go4 v0.0.0-20160222163258-40d72ab9641a/go.mod h1:RVHtZuvrpETIepiNUrNlih2OynoFf1eM6DGC6dloXzk=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
@@ -218,33 +190,21 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4=
github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -264,9 +224,6 @@ github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogeecn/atom v1.0.8 h1:Dr/pF3my7ZxB0OR5IN5Xw4ztjDsL+KpOHq31yxidb8w=
github.com/rogeecn/atom v1.0.8/go.mod h1:BgKU29c4pVZFgumyvIr5rGTG1qEbIOrAQbAsd73cFSA=
github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a h1:3QH7VyOaaiUHNrA9Se4YQIRkDTCw1EJls9xTUCaCeRM=
@@ -274,7 +231,6 @@ github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjI
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
@@ -284,7 +240,6 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
@@ -309,10 +264,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -321,18 +274,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/swaggo/fiber-swagger v1.3.0 h1:RMjIVDleQodNVdKuu7GRs25Eq8RVXK7MwY9f5jbobNg=
github.com/swaggo/fiber-swagger v1.3.0/go.mod h1:18MuDqBkYEiUmeM/cAAB8CI28Bi62d/mys39j1QqF9w=
github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe h1:K8pHPVoTgxFJt1lXuIzzOX7zZhZFldJQK/CgKx9BFIc=
github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w=
github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ=
github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A=
github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.35.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I=
github.com/valyala/fasthttp v1.36.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I=
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
@@ -343,7 +286,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
@@ -362,7 +304,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
@@ -401,7 +342,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -435,10 +375,7 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -460,7 +397,6 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -495,13 +431,9 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -509,7 +441,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -573,7 +504,6 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -672,7 +602,6 @@ google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFW
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
@@ -681,11 +610,7 @@ gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/retry.v1 v1.0.3 h1:a9CArYczAVv6Qs6VGoLMio99GEs7kY9UzSF9+LD+iGs=
gopkg.in/retry.v1 v1.0.3/go.mod h1:FJkXmWiMaAo7xB+xhvDF59zhfjDWyzmyAxiT4dB688g=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@@ -1 +0,0 @@
package users

View File

@@ -1 +0,0 @@
package modules

View File

@@ -0,0 +1,18 @@
package users
import "github.com/gofiber/fiber/v3"
// @provider
type Controller struct {
svc *Service
}
// List
func (c *Controller) List(ctx fiber.Ctx) error {
resp, err := c.svc.List(ctx.Context())
if err != nil {
return err
}
return ctx.JSON(resp)
}

View File

@@ -0,0 +1,53 @@
package users
import (
"backend/providers/http"
"database/sql"
"git.ipao.vip/rogeecn/atom"
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/contracts"
"git.ipao.vip/rogeecn/atom/utils/opt"
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func(
svc *Service,
) (*Controller, error) {
obj := &Controller{
svc: svc,
}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func(
controller *Controller,
http *http.Service,
) (contracts.HttpRoute, error) {
obj := &Router{
controller: controller,
http: http,
}
return obj, nil
}, atom.GroupRoutes); err != nil {
return err
}
if err := container.Container.Provide(func(
db *sql.DB,
) (*Service, error) {
obj := &Service{
db: db,
}
if err := obj.Prepare(); err != nil {
return nil, err
}
return obj, nil
}); err != nil {
return err
}
return nil
}

25
backend/modules/users/router.go Executable file
View File

@@ -0,0 +1,25 @@
package users
import (
"backend/providers/http"
_ "git.ipao.vip/rogeecn/atom"
_ "git.ipao.vip/rogeecn/atom/contracts"
"github.com/gofiber/fiber/v3"
log "github.com/sirupsen/logrus"
)
// @provider:except contracts.HttpRoute atom.GroupRoutes
type Router struct {
http *http.Service
controller *Controller
}
func (r *Router) Register() error {
group := r.http.Engine.Group("users")
log.Infof("register route group: %s", group.(*fiber.Group).Prefix)
group.Get("", r.controller.List)
return nil
}

View File

@@ -0,0 +1,36 @@
package users
import (
"context"
"database/sql"
"backend/database/models/qvyun/public/model"
"backend/database/models/qvyun/public/table"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
// @provider:except
type Service struct {
db *sql.DB
log *logrus.Entry `inject:"false"`
}
func (svc *Service) Prepare() error {
svc.log = logrus.WithField("module", "users.service")
return nil
}
// List
func (svc *Service) List(ctx context.Context) ([]model.Users, error) {
tbl := table.Users
stmt := tbl.SELECT(tbl.AllColumns)
svc.log.WithField("method", "List").Debug(stmt.DebugSql())
var items []model.Users
if err := stmt.QueryContext(ctx, svc.db, &items); err != nil {
return nil, errors.Wrap(err, "failed to query users")
}
return items, nil
}

View File

@@ -1,8 +0,0 @@
package http
type Route interface{}
type Service interface {
Serve() error
GetEngine() interface{}
}

View File

@@ -1,11 +1,11 @@
package fiber
package http
import (
"errors"
"fmt"
"runtime/debug"
"time"
"backend/providers/http"
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
log "github.com/sirupsen/logrus"
@@ -19,31 +19,17 @@ func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(http.DefaultPrefix),
opt.Prefix(DefaultPrefix),
},
}
}
type Service struct {
conf *http.Config
conf *Config
Engine *fiber.App
}
func (e *Service) Use(middleware ...interface{}) fiber.Router {
return e.Engine.Use(middleware...)
}
func (e *Service) GetEngine() interface{} {
return e.Engine
}
func (e *Service) Close() {
if err := e.Engine.Shutdown(); err != nil {
log.Error("http server shutdown error: ", err)
}
}
func (e *Service) Serve() error {
func (svc *Service) Serve() error {
listenConfig := fiber.ListenConfig{
EnablePrintRoutes: true,
OnShutdownSuccess: func() {
@@ -52,32 +38,40 @@ func (e *Service) Serve() error {
OnShutdownError: func(err error) {
log.Error("http server shutdown error: ", err)
},
DisableStartupMessage: true,
// DisableStartupMessage: true,
}
if e.conf.Tls != nil {
if e.conf.Tls.Cert == "" || e.conf.Tls.Key == "" {
if svc.conf.Tls != nil {
if svc.conf.Tls.Cert == "" || svc.conf.Tls.Key == "" {
return errors.New("tls cert or key is empty")
}
listenConfig.CertFile = e.conf.Tls.Cert
listenConfig.CertKeyFile = e.conf.Tls.Key
listenConfig.CertFile = svc.conf.Tls.Cert
listenConfig.CertKeyFile = svc.conf.Tls.Key
}
container.AddCloseAble(func() {
svc.Engine.Shutdown()
})
return e.Engine.Listen(e.conf.PortString(), listenConfig)
return svc.Engine.Listen(svc.conf.PortString(), listenConfig)
}
func Provide(opts ...opt.Option) error {
o := opt.New(opts...)
var config http.Config
var config Config
if err := o.UnmarshalConfig(&config); err != nil {
return err
}
return container.Container.Provide(func(l *log.Logger) (http.Service, error) {
return container.Container.Provide(func() (*Service, error) {
engine := fiber.New(fiber.Config{
StrictRouting: true,
})
engine.Use(recover.New())
engine.Use(recover.New(recover.Config{
EnableStackTrace: true,
StackTraceHandler: func(c fiber.Ctx, e any) {
log.WithError(e.(error)).Error(fmt.Sprintf("panic: %v\n%s\n", e, debug.Stack()))
},
}))
if config.StaticRoute != nil && config.StaticPath != nil {
engine.Use(config.StaticRoute, config.StaticPath)
@@ -89,8 +83,6 @@ func Provide(opts ...opt.Option) error {
TimeZone: "Asia/Shanghai",
}))
svc := &Service{Engine: engine, conf: &config}
container.AddCloseAble(svc.Close)
return svc, nil
return &Service{Engine: engine, conf: &config}, nil
}, o.DiOptions()...)
}

View File

@@ -1,26 +0,0 @@
package swagger
import (
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
)
const DefaultPrefix = "Swagger"
type Config struct {
BaseRoute string
Version string
Host string
BasePath string
Title string
Description string
}
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(DefaultPrefix),
},
}
}

View File

@@ -1,83 +0,0 @@
package swagger
import (
"fmt"
"strings"
"backend/providers/http"
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
jsonpatch "github.com/evanphx/json-patch"
"github.com/gofiber/fiber/v2"
fiberSwagger "github.com/swaggo/fiber-swagger"
"github.com/swaggo/swag"
)
type Swagger struct {
config *Config
http http.Service
}
const infoTpl = `{"schemes": "__ marshal .Schemes __",
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}"}`
func (swagger *Swagger) Load(spec string) error {
original := []byte(spec)
target := []byte(infoTpl)
patch, err := jsonpatch.MergeMergePatches(original, target)
if err != nil {
return err
}
merged, err := jsonpatch.MergePatch(original, patch)
if err != nil {
return err
}
spec = strings.NewReplacer(`"__`, "{{", `__"`, "}}").Replace(string(merged))
swaggerInfo := &swag.Spec{
Version: swagger.config.Version,
Host: swagger.config.Host,
BasePath: swagger.config.BasePath,
Schemes: []string{},
Title: swagger.config.Title,
Description: swagger.config.Description,
InfoInstanceName: "swagger",
SwaggerTemplate: spec,
LeftDelim: "{{",
RightDelim: "}}",
}
swag.Register(swaggerInfo.InstanceName(), swaggerInfo)
engine := swagger.http.GetEngine().(*fiber.App)
engine.Get(fmt.Sprintf("/%s/*", swagger.config.BaseRoute), fiberSwagger.WrapHandler)
return nil
}
func Provide(opts ...opt.Option) error {
o := opt.New(opts...)
var config Config
if err := o.UnmarshalConfig(&config); err != nil {
return err
}
return container.Container.Provide(func(http http.Service) *Swagger {
if config.BaseRoute == "" {
config.BaseRoute = "swagger"
}
return &Swagger{
config: &config,
http: http,
}
}, o.DiOptions()...)
}