Documentation
¶
Index ¶
- Constants
- Variables
- func ReflectColNames(ret reflect.Type) []string
- func ReflectMongoColNames(ret reflect.Type) []string
- type BaseSvc
- func (b *BaseSvc) AccessLogger() golog.ILogger
- func (b *BaseSvc) AlertLog(kind, msg []byte)
- func (b *BaseSvc) CriticalLog(kind, msg []byte)
- func (b *BaseSvc) DebugLog(kind, msg []byte)
- func (b *BaseSvc) EmergencyLog(kind, msg []byte)
- func (b *BaseSvc) ErrorLog(kind, msg []byte)
- func (b *BaseSvc) InfoLog(kind, msg []byte)
- func (b *BaseSvc) NoticeLog(kind, msg []byte)
- func (b *BaseSvc) SetAccessLogger(logger golog.ILogger) *BaseSvc
- func (b *BaseSvc) WarningLog(kind, msg []byte)
- type MongoBaseEntity
- type MongoBaseSvc
- func (s *MongoBaseSvc) DeleteById(tableName string, id interface{}) (bool, error)
- func (s *MongoBaseSvc) FillBaseEntityForInsert(baseEntity *MongoBaseEntity, rev reflect.Value) error
- func (s *MongoBaseSvc) GetById(entityPtr interface{}, tableName string, id interface{}) (bool, error)
- func (s *MongoBaseSvc) Insert(tableName string, colNames []string, entities ...interface{}) ([]interface{}, error)
- func (s *MongoBaseSvc) ReflectQuerySetItems(rev reflect.Value, exists map[string]bool, conditions map[string]string) map[string]interface{}
- func (s *MongoBaseSvc) SelectAll(entityListPtr interface{}, tableName string, mqp *MongoQueryParams, ...) error
- func (s *MongoBaseSvc) UpdateById(tableName string, id interface{}, newEntityPtr interface{}, ...) (error, error)
- type MongoQueryParams
- type RedisBaseSvc
- func (r *RedisBaseSvc) GetHashEntityFromRedis(key string, entityPtr interface{}) (bool, error)
- func (r *RedisBaseSvc) GetJsonDataFromRedis(key string, v interface{}) (bool, error)
- func (r *RedisBaseSvc) SaveHashEntityToRedis(key string, entityPtr interface{}, expireSeconds int64) error
- func (r *RedisBaseSvc) SaveJsonDataToRedis(key string, v interface{}, expireSeconds int64) error
- type SqlBaseEntity
- type SqlBaseSvc
- func (s *SqlBaseSvc) FillBaseEntityForInsert(entity *SqlBaseEntity) error
- func (s *SqlBaseSvc) GetById(tableName string, id int64, entityPtr interface{}) (bool, error)
- func (s *SqlBaseSvc) Insert(tableName string, colNames []string, entities ...interface{}) ([]int64, error)
- func (s *SqlBaseSvc) ListByIds(tableName string, ids []int64, orderBy string, entityType reflect.Type, ...) error
- func (s *SqlBaseSvc) ReflectQueryRowsToEntityList(rows *sql.Rows, ret reflect.Type, listPtr interface{}) error
- func (s *SqlBaseSvc) SimpleQueryAnd(tableName string, sqp *SqlQueryParams, entityType reflect.Type, ...) error
- func (s *SqlBaseSvc) SimpleTotalAnd(tableName string, sqp *SqlQueryParams) (int64, error)
- func (s *SqlBaseSvc) UpdateById(tableName string, id int64, newEntityPtr interface{}, ...) ([]*mysql.SqlColQueryItem, error)
- type SqlQueryParams
- type SqlRedisBindSvc
- func (s *SqlRedisBindSvc) DeleteById(tableName string, id int64) (bool, error)
- func (s *SqlRedisBindSvc) GetById(tableName string, id, expireSeconds int64, entityPtr interface{}) (bool, error)
- func (s *SqlRedisBindSvc) Insert(tableName string, colNames []string, expireSeconds int64, ...) ([]int64, error)
- func (s *SqlRedisBindSvc) RedisKeyForEntity(id int64) string
- func (s *SqlRedisBindSvc) TotalRows(tableName string, expireSeconds int64) (int64, error)
- func (s *SqlRedisBindSvc) UpdateById(tableName string, id int64, newEntityPtr interface{}, ...) (bool, error)
Constants ¶
View Source
const ( ENTITY_MONGO_FIELD_TAG = "bson" ENTITY_MONGO_BASE = "MongoBaseEntity" )
View Source
const (
ENTITY_MYSQL_FIELD_TAG = "mysql"
)
View Source
const (
ENTITY_REDIS_HASH_FIELD_TAG = "redis"
)
Variables ¶
View Source
var LogKindRedisBaseSvc = []byte("RedisBaseSvc")
View Source
var LogKindSqlBaseSvc = []byte("SqlBaseSvc")
View Source
var LogKindSqlRedisBindSvc = []byte("SqlRedisBindSvc")
Functions ¶
func ReflectColNames ¶
func ReflectMongoColNames ¶
Types ¶
type BaseSvc ¶
type BaseSvc struct {
// contains filtered or unexported fields
}
func NewBaseSvc ¶
func NewBaseSvc() *BaseSvc
func (*BaseSvc) AccessLogger ¶
func (*BaseSvc) CriticalLog ¶
func (*BaseSvc) EmergencyLog ¶
func (*BaseSvc) WarningLog ¶
type MongoBaseEntity ¶
type MongoBaseSvc ¶
type MongoBaseSvc struct { *BaseSvc Mclient *mongo.Client Mlogger golog.ILogger EntityName string Dao *dao.MongoDao IdGenter *idgen.MongoIdGenter }
func NewMongoBaseSvc ¶
func NewMongoBaseSvc(bs *BaseSvc, mclient *mongo.Client, entityName string) *MongoBaseSvc
func (*MongoBaseSvc) DeleteById ¶
func (s *MongoBaseSvc) DeleteById(tableName string, id interface{}) (bool, error)
func (*MongoBaseSvc) FillBaseEntityForInsert ¶
func (s *MongoBaseSvc) FillBaseEntityForInsert(baseEntity *MongoBaseEntity, rev reflect.Value) error
func (*MongoBaseSvc) GetById ¶
func (s *MongoBaseSvc) GetById(entityPtr interface{}, tableName string, id interface{}) (bool, error)
func (*MongoBaseSvc) Insert ¶
func (s *MongoBaseSvc) Insert(tableName string, colNames []string, entities ...interface{}) ([]interface{}, error)
func (*MongoBaseSvc) ReflectQuerySetItems ¶
func (*MongoBaseSvc) SelectAll ¶
func (s *MongoBaseSvc) SelectAll(entityListPtr interface{}, tableName string, mqp *MongoQueryParams, setItems map[string]interface{}) error
func (*MongoBaseSvc) UpdateById ¶
type MongoQueryParams ¶
type RedisBaseSvc ¶
func NewRedisBaseSvc ¶
func NewRedisBaseSvc(bs *BaseSvc, rclient *redis.Client) *RedisBaseSvc
func (*RedisBaseSvc) GetHashEntityFromRedis ¶
func (r *RedisBaseSvc) GetHashEntityFromRedis(key string, entityPtr interface{}) (bool, error)
func (*RedisBaseSvc) GetJsonDataFromRedis ¶
func (r *RedisBaseSvc) GetJsonDataFromRedis(key string, v interface{}) (bool, error)
func (*RedisBaseSvc) SaveHashEntityToRedis ¶
func (r *RedisBaseSvc) SaveHashEntityToRedis(key string, entityPtr interface{}, expireSeconds int64) error
func (*RedisBaseSvc) SaveJsonDataToRedis ¶
func (r *RedisBaseSvc) SaveJsonDataToRedis(key string, v interface{}, expireSeconds int64) error
type SqlBaseEntity ¶
type SqlBaseSvc ¶
type SqlBaseSvc struct { *BaseSvc Mclient *mysql.Client Mlogger golog.ILogger EntityName string Dao *mysql.SqlDao IdGenter *idgen.SqlIdGenter }
func NewSqlBaseSvc ¶
func NewSqlBaseSvc(bs *BaseSvc, mclient *mysql.Client, entityName string) *SqlBaseSvc
func (*SqlBaseSvc) FillBaseEntityForInsert ¶
func (s *SqlBaseSvc) FillBaseEntityForInsert(entity *SqlBaseEntity) error
func (*SqlBaseSvc) GetById ¶
func (s *SqlBaseSvc) GetById(tableName string, id int64, entityPtr interface{}) (bool, error)
func (*SqlBaseSvc) Insert ¶
func (s *SqlBaseSvc) Insert(tableName string, colNames []string, entities ...interface{}) ([]int64, error)
func (*SqlBaseSvc) ReflectQueryRowsToEntityList ¶
func (*SqlBaseSvc) SimpleQueryAnd ¶
func (s *SqlBaseSvc) SimpleQueryAnd(tableName string, sqp *SqlQueryParams, entityType reflect.Type, listPtr interface{}) error
func (*SqlBaseSvc) SimpleTotalAnd ¶
func (s *SqlBaseSvc) SimpleTotalAnd(tableName string, sqp *SqlQueryParams) (int64, error)
func (*SqlBaseSvc) UpdateById ¶
func (s *SqlBaseSvc) UpdateById(tableName string, id int64, newEntityPtr interface{}, updateFields map[string]bool) ([]*mysql.SqlColQueryItem, error)
type SqlQueryParams ¶
type SqlRedisBindSvc ¶
type SqlRedisBindSvc struct { *BaseSvc *SqlBaseSvc *RedisBaseSvc RedisKeyPrefix string }
func NewSqlRedisBindSvc ¶
func NewSqlRedisBindSvc(bs *BaseSvc, ss *SqlBaseSvc, rs *RedisBaseSvc, redisKeyPrefix string) *SqlRedisBindSvc
func (*SqlRedisBindSvc) DeleteById ¶
func (s *SqlRedisBindSvc) DeleteById(tableName string, id int64) (bool, error)
func (*SqlRedisBindSvc) GetById ¶
func (s *SqlRedisBindSvc) GetById(tableName string, id, expireSeconds int64, entityPtr interface{}) (bool, error)
func (*SqlRedisBindSvc) RedisKeyForEntity ¶
func (s *SqlRedisBindSvc) RedisKeyForEntity(id int64) string
func (*SqlRedisBindSvc) TotalRows ¶
func (s *SqlRedisBindSvc) TotalRows(tableName string, expireSeconds int64) (int64, error)
func (*SqlRedisBindSvc) UpdateById ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.