query.go
688 字节
package starrocks
import (
"database/sql"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
)
func Query(params QueryOptions, queryFunc func(params QueryOptions) (*sql.Rows, error)) (*domain.DataTable, error) {
rows, err := queryFunc(params)
if err != nil {
return nil, err
}
dataTable := &domain.DataTable{}
dataTable.Data, _ = ScanRows(rows)
return nil, nil
}
type QueryOptions struct {
TableName string
Select []*domain.Field
Where []string
Order []string
Offset int
Limit int
}
type Condition struct {
Field *domain.Field
In []interface{}
Ex []interface{}
Range []interface{}
Order []interface{}
}