Documentation
¶
Index ¶
- Constants
- func CreateMigrationFiles(filename string) error
- func IsDuplicate(err error) bool
- func IsForeignNotFound(err error) bool
- func IsInvalidInput(err error) bool
- func IsNotFound(err error) bool
- func Migration(data *gorm.DB) (*migrate.Migrate, error)
- func TranslateQuery(db *gorm.DB, query *Query) *gorm.DB
- type Config
- type Filter
- type Ordering
- type Query
Constants ¶
View Source
const ( Equal = "Equal" LessThan = "LessThan" GreaterThan = "GreaterThan" GreaterThanEqual = "GreaterThanEqual" LessThanEqual = "LessThanEqual" IN = "IN" JSON = "JSON" Like = "Like" Descending = "Descending" Ascending = "Ascending" )
Variables ¶
This section is empty.
Functions ¶
func CreateMigrationFiles ¶
CreateMigrationFiles for postgres and put in migration folder
func IsDuplicate ¶
IsDuplicate check error from postgres if error is because duplicated record
func IsForeignNotFound ¶
IsForeignNotFound check error from postgres if error is because foreign key not found
func IsInvalidInput ¶
IsInvalidInput check error from postgres if error is because invalid input enumeration
func IsNotFound ¶
IsNotFound check error from postgres if error is because record not found
Types ¶
type Config ¶
type Config struct {
Database string
Host string
Port int
Username string
Password string
Params string
MaxIdleConn int
MaxOpenConn int
LogMode int
DebugEnabled bool
}
Config struct to create new postgres connection client
{
Database: the postgres database name
Host: the postgres database host (localhost)
Port: the postgres database port (5432)
Username: the postgres database username
Password: the postgres database password
Params: the postgres database params, use space to separate value (sslmode=disable TimeZone=Asia/Jakarta)
MaxIdleConn: sets the maximum number of connections in the idle connection pool.
MaxOpenConn: sets the maximum number of open connections to the database.
LogMode: sets log mode, 1(Silent) - 2(Error) - 3(Warn) - 4(Info), default is Error
DebugEnabled: sets true if enabled debug mode, will show query on console
}
type Ordering ¶
Ordering set ordering result
func NewOrdering ¶
NewOrdering create a new property Ordering
Click to show internal directories.
Click to hide internal directories.