mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-03-14 05:55:49 +08:00
feat: 新增系统样式配置,支持改logo图标与标题
This commit is contained in:
@@ -28,17 +28,17 @@ type QueryColumn struct {
|
||||
|
||||
// 执行查询语句
|
||||
// 依次返回 列信息数组(顺序),结果map,错误
|
||||
func (d *DbConn) Query(querySql string) ([]*QueryColumn, []map[string]any, error) {
|
||||
return d.QueryContext(context.Background(), querySql)
|
||||
func (d *DbConn) Query(querySql string, args ...any) ([]*QueryColumn, []map[string]any, error) {
|
||||
return d.QueryContext(context.Background(), querySql, args...)
|
||||
}
|
||||
|
||||
// 执行查询语句
|
||||
// 依次返回 列信息数组(顺序),结果map,错误
|
||||
func (d *DbConn) QueryContext(ctx context.Context, querySql string) ([]*QueryColumn, []map[string]any, error) {
|
||||
func (d *DbConn) QueryContext(ctx context.Context, querySql string, args ...any) ([]*QueryColumn, []map[string]any, error) {
|
||||
result := make([]map[string]any, 0, 16)
|
||||
columns, err := walkTableRecord(ctx, d.db, querySql, func(record map[string]any, columns []*QueryColumn) {
|
||||
result = append(result, record)
|
||||
})
|
||||
}, args...)
|
||||
if err != nil {
|
||||
return nil, nil, wrapSqlError(err)
|
||||
}
|
||||
@@ -111,8 +111,8 @@ func (d *DbConn) Close() {
|
||||
}
|
||||
}
|
||||
|
||||
func walkTableRecord(ctx context.Context, db *sql.DB, selectSql string, walk func(record map[string]any, columns []*QueryColumn)) ([]*QueryColumn, error) {
|
||||
rows, err := db.QueryContext(ctx, selectSql)
|
||||
func walkTableRecord(ctx context.Context, db *sql.DB, selectSql string, walk func(record map[string]any, columns []*QueryColumn), args ...any) ([]*QueryColumn, error) {
|
||||
rows, err := db.QueryContext(ctx, selectSql, args...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package dbm
|
||||
@@ -142,7 +142,7 @@ func (md *MysqlDialect) GetPrimaryKey(tablename string) (string, error) {
|
||||
|
||||
// 获取表索引信息
|
||||
func (md *MysqlDialect) GetTableIndex(tableName string) ([]Index, error) {
|
||||
_, res, err := md.dc.Query(fmt.Sprintf(GetLocalSql(MYSQL_META_FILE, MYSQL_INDEX_INFO_KEY), tableName))
|
||||
_, res, err := md.dc.Query(GetLocalSql(MYSQL_META_FILE, MYSQL_INDEX_INFO_KEY), tableName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ WHERE
|
||||
SELECT
|
||||
database ()
|
||||
)
|
||||
AND table_name = '%s'
|
||||
AND table_name = ?
|
||||
ORDER BY
|
||||
index_name asc,
|
||||
SEQ_IN_INDEX asc
|
||||
|
||||
Reference in New Issue
Block a user