Versions in this module Expand all Collapse all v0 v0.3.0 Aug 15, 2026 Changes in this version + func RunInitSQL(db *gorm.DB, sqlFilePath string) error v0.2.0 Aug 15, 2026 Changes in this version + const FILE_TYPE_AUDIO + const FILE_TYPE_FILE + const FILE_TYPE_IMAGE + const FILE_TYPE_MEDIA + func BytesToString(b []byte) string + func CalculateFileHash(filePath string) (string, error) + func CopyFile(src, dst string) error + func Difference[T comparable](slice1, slice2 []T) []T + func EnsureDirectory(path string) error + func FileExists(path string) bool + func GenerateID() string + func GetContentType(suffix string) (tp string) + func GetDistance(lon1, lat1, lon2, lat2 float64) float64 + func GetFileSize(filePath string) (int64, error) + func GetFileType(buf []byte) (fileType string) + func GetFileTypeBySuffix(suffix string) int32 + func InArray[T comparable](needle T, haystack []T) bool + func Intersect[T comparable](slice1, slice2 []T) []T + func IsDirectory(path string) bool + func IsFile(path string) bool + func Join[T any](arg []T, str string) string + func Merge[T any](slice1, slice2 []T) []T + func RemoveDirectory(path string) error + func RemoveFile(path string) error + func StringToBytes(s string) []byte + func Unique[T comparable](slice []T) []T v0.1.0 Aug 15, 2026 Changes in this version + var SnowflakeUtil = (*idgen.Snowflake)(nil) + func ClampSnowflakeUint(id uint) uint + func ConfigureConnectionPool(db *gorm.DB) + func EnvDuration(key string) (time.Duration, bool) + func EnvFloat(key string) (float64, bool) + func EnvInt(key string) (int, bool) + func GetBoolEnv(key string) bool + func GetBoolOrDefault(key string, defaultValue bool) bool + func GetEnv(key string) string + func GetFloatEnv(key string) float64 + func GetFloatEnvWithDefault(key string, defaultValue float64) float64 + func GetFloatOrDefault(key string, defaultValue float64) float64 + func GetIntEnv(key string) int64 + func GetIntEnvWithDefault(key string, defaultValue int) int + func GetIntOrDefault(key string, defaultValue int) int + func GetStringOrDefault(key, defaultValue string) string + func InitDatabase(logWrite io.Writer, driver, dsn string) (*gorm.DB, error) + func LoadEnv(env string) error + func LoadEnvs(objPtr any) + func LookupEnv(key string) (value string, found bool) + func MakeMigrates(db *gorm.DB, insts []any) error + func NewSnowflake() (*idgen.Snowflake, error) + func NextSnowflakeUint() uint + func ParseDuration(s string, defaultVal time.Duration) time.Duration + func PositiveIntEnv(key string) (int, bool) + func PurgeEnvCacheForTest() + type BaseModel struct + CreateBy string + CreatedAt time.Time + DeletedAt gorm.DeletedAt + ID uint + Remark string + UpdateBy string + UpdatedAt time.Time + func (m *BaseModel) BeforeCreate(tx *gorm.DB) error + func (m *BaseModel) BeforeUpdate(tx *gorm.DB) error + func (m *BaseModel) Restore(operator string) + func (m *BaseModel) SetCreateInfo(operator string) + func (m *BaseModel) SetUpdateInfo(operator string) + func (m *BaseModel) SoftDelete(operator string) + type QueryResult struct + Err error + Value any + Value2 any + type SigHandler struct + Handler SignalHandler + ID uint + type SignalHandler func(sender any, params ...any) + type Signals struct + func NewSignals() *Signals + func Sig() *Signals + func (s *Signals) Clear(events ...string) + func (s *Signals) Connect(event string, handler SignalHandler) uint + func (s *Signals) Disconnect(event string, id uint) + func (s *Signals) Emit(event string, sender any, params ...any) + func (s *Signals) Query(event string, params ...any) *QueryResult