Documentation
¶
Index ¶
- Variables
- func DeleteEntityById(entityType string, id int64) error
- func GetDBType() string
- func GetEntityType() []string
- func HasSchema(entityType string) bool
- func InsertEntity(entity commEntity.IEntity) error
- func InsertRecord(tableName string, entity commEntity.IEntity) error
- func Query(entityType string, sql string) ([]commEntity.IEntity, error)
- func QueryCount(sql string) (int, error)
- func QueryEntityById(entityType string, id int64) (commEntity.IEntity, error)
- func QueryEntityList(entityType string) ([]commEntity.IEntity, error)
- func Register(entityType string)
- func SQuery(entityType string, sql string, args []interface{}) ([]commEntity.IEntity, error)
- func SQueryCount(sql string, args []interface{}) (int, error)
- func UpdateEntityById(entity commEntity.IEntity) error
- func UpdateRecordById(tableName string, entity commEntity.IEntity) error
- type EntitySQL
- func (e *EntitySQL) DeleteWhere(entityType string, where string) (string, error)
- func (e *EntitySQL) DeleteWhereId(entityType string, id int64) (string, error)
- func (e *EntitySQL) Insert(entity commEntity.IEntity) (string, []interface{}, error)
- func (e *EntitySQL) InsertRecord(tblName string, entity commEntity.IEntity) (string, []interface{}, error)
- func (e *EntitySQL) Select(entityType string) (string, error)
- func (e *EntitySQL) SelectWhere(entityType string, where string) (string, error)
- func (e *EntitySQL) SelectWhereId(entityType string, id int64) (string, error)
- func (e *EntitySQL) UpdateRecordWhereId(tableName string, entity commEntity.IEntity) (string, []interface{}, error)
- func (e *EntitySQL) UpdateWhereId(entity commEntity.IEntity) (string, []interface{}, error)
- type FieldValue
- type SQLOption
- type SqlClient
- func (e *SqlClient) ConnectMySQL() error
- func (e *SqlClient) ConnectSQLite(fileName string) error
- func (e *SqlClient) Exec(sql string, values []interface{}) (int64, error)
- func (e *SqlClient) Query(entityType string, sql string) ([]commEntity.IEntity, error)
- func (e *SqlClient) QueryCount(sql string) (int, error)
- func (e *SqlClient) QueryList(sql string, fields []FieldValue) ([]map[string]interface{}, error)
- func (e *SqlClient) SQuery(entityType string, sql string, args []interface{}) ([]commEntity.IEntity, error)
- func (e *SqlClient) SQueryCount(sql string, args []interface{}) (int, error)
- func (e *SqlClient) SQueryList(sql string, fields []FieldValue, args []interface{}) ([]map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SQL EntitySQL Client *SqlClient Fox foxSqlService SqlBuilder sqlBuilder EntityEngine clientEntityEngine )
Functions ¶
func DeleteEntityById ¶
func GetEntityType ¶ added in v1.0.1
func GetEntityType() []string
func InsertEntity ¶
func InsertEntity(entity commEntity.IEntity) error
func InsertRecord ¶ added in v1.0.2
func InsertRecord(tableName string, entity commEntity.IEntity) error
func QueryCount ¶ added in v1.0.1
func QueryEntityById ¶
func QueryEntityById(entityType string, id int64) (commEntity.IEntity, error)
func QueryEntityList ¶
func QueryEntityList(entityType string) ([]commEntity.IEntity, error)
func SQuery ¶ added in v1.0.2
func SQuery(entityType string, sql string, args []interface{}) ([]commEntity.IEntity, error)
func SQueryCount ¶ added in v1.0.2
func UpdateEntityById ¶
func UpdateEntityById(entity commEntity.IEntity) error
func UpdateRecordById ¶ added in v1.0.2
func UpdateRecordById(tableName string, entity commEntity.IEntity) error
Types ¶
type EntitySQL ¶ added in v1.0.2
type EntitySQL struct {
}
func (*EntitySQL) DeleteWhere ¶ added in v1.0.2
func (*EntitySQL) DeleteWhereId ¶ added in v1.0.2
func (*EntitySQL) Insert ¶ added in v1.0.2
func (e *EntitySQL) Insert(entity commEntity.IEntity) (string, []interface{}, error)
func (*EntitySQL) InsertRecord ¶ added in v1.0.2
func (*EntitySQL) SelectWhere ¶ added in v1.0.2
func (*EntitySQL) SelectWhereId ¶ added in v1.0.2
func (*EntitySQL) UpdateRecordWhereId ¶ added in v1.0.2
func (*EntitySQL) UpdateWhereId ¶ added in v1.0.2
func (e *EntitySQL) UpdateWhereId(entity commEntity.IEntity) (string, []interface{}, error)
type FieldValue ¶ added in v1.0.1
type FieldValue struct {
Name string
Value interface{} //字段的数值
}
type SqlClient ¶ added in v1.0.2
type SqlClient struct {
// contains filtered or unexported fields
}
func (*SqlClient) ConnectMySQL ¶ added in v1.0.2
func (*SqlClient) ConnectSQLite ¶ added in v1.0.2
func (*SqlClient) Exec ¶ added in v1.0.2
Exec 执行sql 参数:
sql 准备执行的sql语句 values sql语言中的参数表
说明:如果你构造的values参数为nil,那么你要确保自己的sql不含有文本参数的语句,不会发生注入式攻击
func (*SqlClient) QueryCount ¶ added in v1.0.2
func (*SqlClient) QueryList ¶ added in v1.0.2
func (e *SqlClient) QueryList(sql string, fields []FieldValue) ([]map[string]interface{}, error)
func (*SqlClient) SQuery ¶ added in v1.0.2
func (e *SqlClient) SQuery(entityType string, sql string, args []interface{}) ([]commEntity.IEntity, error)
SQuery 安全查询数据 说明:带预处理的方式执行SQL语句,防止注入攻击,或者特殊字符的冲突
func (*SqlClient) SQueryCount ¶ added in v1.0.2
func (*SqlClient) SQueryList ¶ added in v1.0.2
func (e *SqlClient) SQueryList(sql string, fields []FieldValue, args []interface{}) ([]map[string]interface{}, error)
Click to show internal directories.
Click to hide internal directories.