core

package
v0.0.0-...-b00f2dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	OAuthConfig OAuthConfig `mapstructure:"oauthconfig" json:"oauthconfig" yaml:"oauthconfig"`
	RedisConfig RedisConfig `mapstructure:"redisconfig" json:"redisconfig" yaml:"redisconfig"`
	DbConfig    DbConfig    `mapstructure:"dbconfig" json:"dbconfig" yaml:"dbconfig"`
}

type AppError

type AppError struct {
	Code    int    `json:",omitempty"`
	Message string `json:"message"`
}

func AsAppError

func AsAppError(err error) *AppError

func NewAuthenticationError

func NewAuthenticationError(message string) *AppError

func NewAuthorizationError

func NewAuthorizationError(message string) *AppError

func NewNotFoundError

func NewNotFoundError(message string) *AppError

func NewUnexpectedError

func NewUnexpectedError(message string) *AppError

func NewValidationError

func NewValidationError(message string) *AppError

type DbBaseModel

type DbBaseModel struct {
	Id          string `json:"id" gorm:"primaryKey;size:32"`
	DataVersion int64  `json:"data_version"`
	DataStatus  int    `json:"data_status"`
	CreateTime  int64  `json:"create_time" gorm:"autoCreateTime:milli"`
	UpdateTime  int64  `json:"update_time" gorm:"autoUpdateTime:milli"`
}

func NewDbBaseModel

func NewDbBaseModel(id string) DbBaseModel

type DbConfig

type DbConfig struct {
	DbType          string `mapstructure:"db_type" json:"db_type" yaml:"db_type"`
	Host            string `mapstructure:"host" json:"host" yaml:"host"`
	Port            string `mapstructure:"port" json:"port" yaml:"port"`
	Config          string `mapstructure:"config" json:"config" yaml:"config"`
	User            string `mapstructure:"user" json:"user" yaml:"user"`
	Password        string `mapstructure:"password" json:"password" yaml:"password"`
	DbName          string `mapstructure:"db_name" json:"db_name" yaml:"db_name"`
	MaxIdleConns    int    `mapstructure:"max_idle_conns" json:"max_idle_conns" yaml:"max_idle_conns"`
	MaxOpenConns    int    `mapstructure:"max_open_conns" json:"max_open_conns" yaml:"max_open_conns"`
	ConnMaxLifetime string `mapstructure:"conn_max_lifetime" json:"conn_max_lifetime" yaml:"conn_max_lifetime"`
}

type DbContext

type DbContext interface {
	DSN() string
	GetDb() *gorm.DB
}

type DbQuery

type DbQuery struct {
	QueryWheres []DbQueryWhere   `json:"query_wheres"`
	OrderBy     []DbQueryOrderBy `json:"order_by"`
	PageSize    int              `json:"page_size"`
	PageNumber  int              `json:"page_number"`
}

func NewDbQuery

func NewDbQuery(wheres []DbQueryWhere, ps int, pn int, order []DbQueryOrderBy) *DbQuery

func (*DbQuery) GetWhereClause

func (q *DbQuery) GetWhereClause() (whereClause string, values []interface{}, order string)

type DbQueryFilter

type DbQueryFilter struct {
	FieldName       string        `json:"field_name"`
	FilterValues    []interface{} `json:"filter_values"`
	FilterOperation string        `json:"filter_operation"`
	Connecter       string        `json:"connecter"`
	FieldType       string        `json:"field_type"`
}

func NewDbQueryFilter

func NewDbQueryFilter(field string, values []interface{}, op string, ft string) DbQueryFilter

type DbQueryOrderBy

type DbQueryOrderBy struct {
	FieldName string `json:"field_name"`
	IsAsc     bool   `json:"is_asc"`
}

func NewDDbQueryOrderBy

func NewDDbQueryOrderBy(field string, asc bool) DbQueryOrderBy

type DbQueryWhere

type DbQueryWhere struct {
	QueryFilters []DbQueryFilter `json:"query_filters"`
	Connecter    string          `json:"connecter"`
}

func NewDbQueryWhere

func NewDbQueryWhere(filters []DbQueryFilter, connector string) DbQueryWhere

type OAuthConfig

type OAuthConfig struct {
	SecretKey          string `mapstructure:"secret_key" json:"secret_key" yaml:"secret_key"`
	AccessExpiresTime  string `mapstructure:"access_expires_time" json:"access_expires_time" yaml:"access_expires_time"`
	RefreshExpiresTime string `mapstructure:"refresh_expires_time" json:"refresh_expires_time" yaml:"refresh_expires_time"`
	Issuer             string `mapstructure:"issuer" json:"issuer" yaml:"issuer"`
}

type RedisConfig

type RedisConfig struct {
	DB       int    `mapstructure:"db" json:"db" yaml:"db"`
	Addr     string `mapstructure:"host" json:"host" yaml:"host"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL