feat: 删除不再使用的模板文件和相关代码,优化项目结构

This commit is contained in:
Rogee
2025-09-10 16:32:51 +08:00
parent 384b723f51
commit 2d5bac5bf5
7 changed files with 8 additions and 80 deletions

View File

@@ -0,0 +1,6 @@
ignores:
- migrations
imports:
- go.ipao.vip/gen
field_type:
field_relate:

View File

@@ -1,11 +0,0 @@
package conds
import (
. "github.com/go-jet/jet/v2/postgres"
)
type Cond func(BoolExpression) BoolExpression
func Default() BoolExpression {
return BoolExp(Bool(true))
}

View File

@@ -5,22 +5,11 @@ import (
"database/sql"
"embed"
"fmt"
"github.com/go-jet/jet/v2/qrm"
)
//go:embed migrations/*
var MigrationFS embed.FS
type CtxDB struct{}
func FromContext(ctx context.Context, db *sql.DB) qrm.DB {
if tx, ok := ctx.Value(CtxDB{}).(*sql.Tx); ok {
return tx
}
return db
}
func Truncate(ctx context.Context, db *sql.DB, tableName ...string) error {
for _, name := range tableName {
sql := fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", name)

View File

@@ -1,45 +0,0 @@
package fields
import (
"database/sql/driver"
"encoding/json"
"errors"
)
// implement sql.Scanner interface
type Json[T any] struct {
Data T `json:",inline"`
}
func ToJson[T any](data T) Json[T] {
return Json[T]{Data: data}
}
func (x *Json[T]) Scan(value interface{}) (err error) {
switch v := value.(type) {
case string:
return json.Unmarshal([]byte(v), &x)
case []byte:
return json.Unmarshal(v, &x)
case *string:
return json.Unmarshal([]byte(*v), &x)
}
return errors.New("Unknown type for ")
}
func (x Json[T]) Value() (driver.Value, error) {
return json.Marshal(x.Data)
}
func (x Json[T]) MarshalJSON() ([]byte, error) {
return json.Marshal(x.Data)
}
func (x *Json[T]) UnmarshalJSON(data []byte) error {
var value T
if err := json.Unmarshal(data, &value); err != nil {
return err
}
x.Data = value
return nil
}

View File

@@ -1,13 +0,0 @@
ignores:
jet:
- migrations
- river_leader
- river_job
- river_client
- river_client_queue
- river_queue
model:
types:
# users: # table name
# meta: UserMeta
# meta: Json[UserMeta]

View File

@@ -0,0 +1,2 @@
{
}