Documentation ¶
Index ¶
- Constants
- func GetLimitOffset(page, size int) (limit int, offset int)
- func GetMetaWithError(err error) *v1.Metadata
- func GetMetaWithErrorString(err string) *v1.Metadata
- func GetPageInfo(total int64, page, size int32) int32
- func GetSnowflakeId() int64
- func GetSuccessMeta() *v1.Metadata
- func InitDefaultSnowflakeNode(node int64)
- func InitStdLogger(config *conf.App) log.Logger
- func ParseToDateString(t time.Time) string
- type DBClient
- func (c *DBClient) DB(ctx context.Context) *gorm.DB
- func (c *DBClient) ExecTx(ctx context.Context, fn func(ctx context.Context) error) error
- func (c *DBClient) GetDB() *gorm.DB
- func (c *DBClient) WhereWithPaginateAndSort(ctx context.Context, fn WhereConditionFn, value interface{}, sort string, ...) *gorm.DB
- type Transaction
- type WhereConditionFn
Constants ¶
View Source
const ( JustNow = "刚刚" MinutesAgo = "%d分钟前" HoursAgo = "%d小时前" DaysAgo = "%d天前" )
Variables ¶
This section is empty.
Functions ¶
func GetLimitOffset ¶ added in v0.1.3
func GetMetaWithError ¶
func GetMetaWithErrorString ¶
func GetPageInfo ¶ added in v0.1.6
func GetSnowflakeId ¶
func GetSnowflakeId() int64
func GetSuccessMeta ¶
func InitDefaultSnowflakeNode ¶
func InitDefaultSnowflakeNode(node int64)
func ParseToDateString ¶ added in v0.1.3
ParseToDateString 将time.Time转换为日期字符串
Types ¶
type DBClient ¶
type DBClient struct {
// contains filtered or unexported fields
}
func (*DBClient) WhereWithPaginateAndSort ¶
func (c *DBClient) WhereWithPaginateAndSort( ctx context.Context, fn WhereConditionFn, value interface{}, sort string, request *dto.PaginationRequest, ) *gorm.DB
type Transaction ¶
Click to show internal directories.
Click to hide internal directories.