Documentation
¶
Index ¶
- func Delete(db *gorm.DB, tableName string, id uint64) error
- func Exists(db *gorm.DB, tableName, column string, value interface{}, withDeletedAt bool) (bool, error)
- func ExistsByColumn(db *gorm.DB, tableName, column string, value interface{}) (bool, error)
- func ExistsByFilterExprs(db *gorm.DB, tableName string, filters dbi.FilterExprs) (bool, error)
- func ExistsById(db *gorm.DB, tableName string, id uint64) (bool, error)
- func ExistsByIdWithDeletedAt(db *gorm.DB, tableName string, id uint64) (bool, error)
- func ExistsByQuerySQL(db *gorm.DB, qsql string, value ...any) (bool, error)
- func ExistsBySQL(db *gorm.DB, sql string, value ...any) (bool, error)
- func GetById[T any](db *gorm.DB, id int) (*T, error)
- func GetDBWithContext(db *gorm.DB, ctx context.Context) *gorm.DB
- func GetDBWithLogger(db *gorm.DB, log *log.Logger, conf *logger.Config) *gorm.DB
- func NewTraceDB(db *gorm.DB, ctx context.Context, traceId string) *gorm.DB
- type ChainDao
- type Config
- type FilterExprs
- type Mysql
- type Postgres
- type PrometheusConfig
- type Repository
- type Repository2
- type Repository3
- type Sqlite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsByColumn ¶ added in v1.6.13
func ExistsByFilterExprs ¶ added in v1.6.13
func ExistsById ¶ added in v1.6.13
func ExistsByIdWithDeletedAt ¶ added in v1.6.13
func ExistsByQuerySQL ¶ added in v1.6.13
根据查询语句查询数据是否存在
func ExistsBySQL ¶ added in v1.6.13
func GetDBWithContext ¶ added in v1.6.13
func GetDBWithLogger ¶ added in v1.6.13
Types ¶
type ChainDao ¶
func (*ChainDao) ByIdNoCheck ¶ added in v1.6.13
func (*ChainDao) ByNameNoCheck ¶ added in v1.6.13
type Config ¶
type Config struct {
Type, Charset, Database, TimeZone string
Host string `flag:"name:db_host;usage:数据库host"`
Port int32
User, Password string
Postgres Postgres
Mysql Mysql
Sqlite Sqlite
MaxIdleConns, MaxOpenConns int
ConnMaxLifetime, ConnMaxIdleTime time.Duration
Gorm gorm.Config
EnableStdLogger bool
Logger logger.Config
NamingStrategy schema.NamingStrategy
EnablePrometheus bool
Prometheus prometheus.Config
PrometheusConfigs []PrometheusConfig
}
type FilterExprs ¶ added in v1.6.13
type FilterExprs dbi.FilterExprs
type PrometheusConfig ¶
type Repository ¶
func NewRepository ¶
func (*Repository[T]) Create ¶
func (r *Repository[T]) Create(t *T) error
func (*Repository[T]) Delete ¶
func (r *Repository[T]) Delete(id int) error
func (*Repository[T]) Retrieve ¶ added in v1.6.13
func (r *Repository[T]) Retrieve(id int) (*T, error)
func (*Repository[T]) Update ¶
func (r *Repository[T]) Update(t *T) error
type Repository2 ¶ added in v1.6.13
func (*Repository2[T]) GetById ¶ added in v1.6.13
func (db *Repository2[T]) GetById(id int) (*T, error)
type Repository3 ¶ added in v1.6.13
func (*Repository3[T]) GetById ¶ added in v1.6.13
func (db *Repository3[T]) GetById(id int) (*T, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.