Documentation
¶
Index ¶
- Constants
- func AndConditionBy(param any) clause.Expression
- func ByName(name string) clause.Expression
- func ByPrimary(id any) clause.Expression
- func ByPrimaryKey(v any) clause.Expression
- func ConditionsBy(param any) []clause.Expression
- func Delete(db *gorm.DB, tableName string, column string, value any) error
- func DeleteByPrimary(db *gorm.DB, tableName string, primary any) error
- func Exists(db *gorm.DB, tableName, column string, value any, withDeletedAt bool) (bool, error)
- func ExistsByColumn(db *gorm.DB, tableName, column string, value any) (bool, error)
- func ExistsByColumnWithDeletedAt(db *gorm.DB, tableName, column string, value any) (bool, error)
- func ExistsByFilterExprs(db *gorm.DB, tableName string, filters sqlx.FilterExprs) (bool, error)
- func ExistsByQuery(db *gorm.DB, qsql string, value ...any) (bool, error)
- func ExistsBySQL(db *gorm.DB, sql string, value ...any) (bool, error)
- func FindList[T any](db *gorm.DB, list *sqlx.List) ([]T, int64, error)
- func Generator(db *gorm.DB, outPath, modelPkgPath string, tables ...string) error
- func GetByPrimary[T any](db *gorm.DB, primary any) (*T, error)
- func New(loger *zap.Logger, conf *logger.Config) logger.Interface
- func NewCondition(field string, op sqlx.ConditionOperation, args any) clause.Expression
- func NotConditionBy(param any) clause.Expression
- func OrConditionBy(param any) clause.Expression
- func PaginationExpr(pageNo, pageSize uint32) clause.Expression
- func SetTranceId(ctx context.Context, traceId string) context.Context
- func SingleSortExpr(field string, sortType sqlx.SortType) clause.Expression
- func SortExpr(expr clause.Expression, sorts ...sqlx.Sort) clause.Expression
- func TableName(tx *gorm.DB, name string) *gorm.DB
- func TraceId(ctx context.Context) string
- type Between
- type Clause
- type Clauses
- type Collector
- type ConditionExpr
- type ConditionsExpr
- type Config
- type CustomMetric
- type FilterExpr
- type FilterExprs
- type IsNotNull
- type IsNull
- type JSONSerializer
- type Json
- type Limit
- type Location
- type Logger
- func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) LogMode(level logger.LogLevel) logger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})
- type Not
- type NotLike
- type OTelPlugin
- type Option
- type Pagination
- type PaginationEmbedded
- type Range
- type RecordContext
- type Sort
- type Sorts
- type StringArraySerializer
Constants ¶
View Source
const ScopeName = "github.com/hopeio/gox/database/sql/gorm"
Variables ¶
This section is empty.
Functions ¶
func AndConditionBy ¶ added in v1.10.0
func AndConditionBy(param any) clause.Expression
func ByName ¶ added in v1.10.0
func ByName(name string) clause.Expression
func ByPrimary ¶ added in v1.10.0
func ByPrimary(id any) clause.Expression
func ByPrimaryKey ¶ added in v1.10.0
func ByPrimaryKey(v any) clause.Expression
func ConditionsBy ¶ added in v1.10.0
func ConditionsBy(param any) []clause.Expression
func DeleteByPrimary ¶ added in v1.10.0
func ExistsByColumn ¶
func ExistsByFilterExprs ¶
func ExistsByQuery ¶
根据查询语句查询数据是否存在
func NewCondition ¶ added in v1.10.0
func NewCondition(field string, op sqlx.ConditionOperation, args any) clause.Expression
func NotConditionBy ¶ added in v1.10.0
func NotConditionBy(param any) clause.Expression
func OrConditionBy ¶ added in v1.10.0
func OrConditionBy(param any) clause.Expression
func PaginationExpr ¶ added in v1.10.0
func PaginationExpr(pageNo, pageSize uint32) clause.Expression
func SetTranceId ¶ added in v1.10.0
func SingleSortExpr ¶ added in v1.10.0
func SingleSortExpr(field string, sortType sqlx.SortType) clause.Expression
func SortExpr ¶ added in v1.10.0
func SortExpr(expr clause.Expression, sorts ...sqlx.Sort) clause.Expression
Types ¶
type Between ¶ added in v1.10.0
func (Between) NegationBuild ¶ added in v1.10.0
type Clause ¶ added in v1.10.0
type Clause interface {
Clause() clause.Expression
}
type Clauses ¶ added in v1.10.0
type Clauses interface {
Clauses() []clause.Expression
}
type ConditionExpr ¶ added in v1.10.0
type ConditionExpr interface {
Condition() clause.Expression
}
type ConditionsExpr ¶ added in v1.10.0
type ConditionsExpr interface {
Conditions() []clause.Expression
}
type CustomMetric ¶ added in v1.10.2
type CustomMetric interface {
Init(meter metric.Meter) error
Record(*RecordContext)
}
type FilterExpr ¶ added in v1.10.0
type FilterExpr sqlx.FilterExpr
func (*FilterExpr) Condition ¶ added in v1.10.0
func (f *FilterExpr) Condition() clause.Expression
type FilterExprs ¶ added in v1.10.0
type FilterExprs sqlx.FilterExprs
func (FilterExprs) Condition ¶ added in v1.10.0
func (f FilterExprs) Condition() clause.Expression
func (FilterExprs) Conditions ¶ added in v1.10.0
func (f FilterExprs) Conditions() []clause.Expression
type IsNotNull ¶ added in v1.10.0
type IsNotNull IsNull
func (IsNotNull) NegationBuild ¶ added in v1.10.0
type IsNull ¶ added in v1.10.0
type IsNull struct {
Column any
}
func (IsNull) NegationBuild ¶ added in v1.10.0
type JSONSerializer ¶ added in v1.10.0
type JSONSerializer struct {
}
JSONSerializer json序列化器
type Json ¶ added in v1.10.0
func (*Json[T]) GormDBDataType ¶ added in v1.10.0
type Limit ¶ added in v1.10.0
Limit limit clause
func (Limit) MergeClause ¶ added in v1.10.0
MergeClause merge order by clauses
type Location ¶ added in v1.10.0
type Location struct {
X, Y float64
}
func (Location) GormDataType ¶ added in v1.10.0
type Logger ¶ added in v1.10.0
type Not ¶ added in v1.10.0
type Not struct {
Expr clause.NegationExpressionBuilder
}
type OTelPlugin ¶ added in v1.10.2
type OTelPlugin struct {
// contains filtered or unexported fields
}
func NewOTelPlugin ¶ added in v1.10.2
func NewOTelPlugin(prefix string, opts ...Option) *OTelPlugin
func (*OTelPlugin) Initialize ¶ added in v1.10.2
func (p *OTelPlugin) Initialize(db *gorm.DB) error
func (*OTelPlugin) Name ¶ added in v1.10.2
func (p *OTelPlugin) Name() string
type Option ¶ added in v1.10.2
type Option func(*OTelPlugin)
func WithAttributes ¶ added in v1.10.2
func WithCustomMetrics ¶ added in v1.10.2
func WithCustomMetrics(metrics ...CustomMetric) Option
type Pagination ¶ added in v1.10.0
type Pagination sqlx.Pagination
func (*Pagination) Clause ¶ added in v1.10.0
func (req *Pagination) Clause() clause.Expression
type PaginationEmbedded ¶ added in v1.10.0
type PaginationEmbedded sqlx.PaginationEmbedded
func (*PaginationEmbedded) ToPagination ¶ added in v1.10.0
func (req *PaginationEmbedded) ToPagination() *Pagination
type Range ¶ added in v1.10.0
func (*Range[T]) Condition ¶ added in v1.10.0
func (req *Range[T]) Condition() clause.Expression
type RecordContext ¶ added in v1.10.2
type Sort ¶ added in v1.10.0
func (*Sort) Clause ¶ added in v1.10.0
func (o *Sort) Clause() clause.Expression
type Sorts ¶ added in v1.10.0
func (Sorts) Clause ¶ added in v1.10.0
func (o Sorts) Clause() clause.Expression
Click to show internal directories.
Click to hide internal directories.