Skip to content

Conversation

@qinyuguang
Copy link
Contributor

No description provided.

gqcn and others added 30 commits June 6, 2021 23:06
Fixed incorrect type conversion
add timezone configuration for package gdb
add gutil.SliceToMapWithColumnAsKey
…ark funtcion Struct/Structs deprecated for gdb.Model
@qinyuguang qinyuguang changed the base branch from master to develop June 24, 2021 09:09
DoDelete(ctx context.Context, link Link, table string, condition string, args ...interface{}) (result sql.Result, err error) // See Core.DoDelete.
DoQuery(ctx context.Context, link Link, sql string, args ...interface{}) (rows *sql.Rows, err error) // See Core.DoQuery.
DoExec(ctx context.Context, link Link, sql string, args ...interface{}) (result sql.Result, err error) // See Core.DoExec.
DoCommit(ctx context.Context, link Link, sql string, args []interface{}) (newSql string, newArgs []interface{}) // See Core.DoCommit.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface method result newSql should be newSQL

Model(tableNameOrStruct ...interface{}) *Model

// Raw creates and returns a model based on a raw sql not a table.
Raw(rawSql string, args ...interface{}) *Model
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface method parameter rawSql should be rawSQL

}
// Handle the field names and place holders.
for k, _ := range listMap[0] {
for k, _ := range list[0] {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should omit 2nd value from range; this loop is equivalent to for k := range ...

if composedSqlStr == "" {
composedSqlStr += fmt.Sprintf(`(%s)`, sqlWithHolder)
} else {
composedSqlStr += fmt.Sprintf(` %s (%s)`, unionTypeStr, sqlWithHolder)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var composedSqlStr should be composedSQLStr

for _, v := range unions {
sqlWithHolder, holderArgs := v.getFormattedSqlAndArgs(queryTypeNormal, false)
if composedSqlStr == "" {
composedSqlStr += fmt.Sprintf(`(%s)`, sqlWithHolder)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var composedSqlStr should be composedSQLStr

func (c *Core) doUnion(unionType int, unions ...*Model) *Model {
var (
unionTypeStr string
composedSqlStr string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var composedSqlStr should be composedSQLStr

listLength = len(list)
valueHolder = make([]string, 0)
)
for k, _ := range list[0] {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should omit 2nd value from range; this loop is equivalent to for k := range ...

}

func (d *DriverOracle) DoBatchInsert(ctx context.Context, link Link, table string, list interface{}, option int, batch ...int) (result sql.Result, err error) {
func (d *DriverOracle) DoInsert(ctx context.Context, link Link, table string, list List, option DoInsertOption) (result sql.Result, err error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method DriverOracle.DoInsert should have comment or be unexported

// HandleSqlBeforeCommit deals with the sql string before commits it to underlying sql driver.
func (d *DriverOracle) HandleSqlBeforeCommit(ctx context.Context, link Link, sql string, args []interface{}) (newSql string, newArgs []interface{}) {
// DoCommit deals with the sql string before commits it to underlying sql driver.
func (d *DriverOracle) DoCommit(ctx context.Context, link Link, sql string, args []interface{}) (newSql string, newArgs []interface{}) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method result newSql should be newSQL

return model
}

func (tx *TX) Raw(rawSql string, args ...interface{}) *Model {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method TX.Raw should have comment or be unexported
method parameter rawSql should be rawSQL

// Example:
// db.Raw("SELECT * FROM `user` WHERE `name` = ?", "john").Scan(&result)
// See Core.Raw.
func (m *Model) Raw(rawSql string, args ...interface{}) *Model {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method parameter rawSql should be rawSQL

// Raw creates and returns a model based on a raw sql not a table.
// Example:
// db.Raw("SELECT * FROM `user` WHERE `name` = ?", "john").Scan(&result)
func (c *Core) Raw(rawSql string, args ...interface{}) *Model {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method parameter rawSql should be rawSQL

type Model struct {
db DB // Underlying DB interface.
tx *TX // Underlying TX interface.
rawSql string // rawSql is the raw SQL string which marks a raw SQL based Model not a table based Model.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field rawSql should be rawSQL

}
// Format DoInsertOption, especially for "ON DUPLICATE KEY UPDATE" statement.
columnNames := make([]string, 0, len(list[0]))
for k, _ := range list[0] {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should omit 2nd value from range; this loop is equivalent to for k := range ...

}

func (m *Model) getFormattedSqlAndArgs(queryType string, limit1 bool) (sqlWithHolder string, holderArgs []interface{}) {
func (m *Model) getFormattedSqlAndArgs(queryType int, limit1 bool) (sqlWithHolder string, holderArgs []interface{}) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method getFormattedSqlAndArgs should be getFormattedSQLAndArgs

type User struct {
Id int `json:"id"`
Nickname string `gconv:"nickname"`
Id int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field Id should be ID

defer dropTable(table)

type User struct {
Id int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field Id should be ID

debugKey = "gf.debug" // Debug key for checking if in debug mode.
StackFilterKeyForGoFrame = "/github.com/gogf/gf/" // Stack filtering key for all GoFrame module paths.
debugKey = "gf.debug" // Debug key for checking if in debug mode.
StackFilterKeyForGoFrame = "github.com/gogf/gf@" // Stack filtering key for all GoFrame module paths.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const StackFilterKeyForGoFrame should have comment (or a comment on this block) or be unexported

// 获取内容列表
type ContentGetListReq struct {
ContentGetListInput
CategoryId uint `p:"cate"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field CategoryId should be CategoryID

Page int
Size int
Sort int
UserId uint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field UserId should be UserID

// 获取内容列表
type ContentGetListInput struct {
Type string
CategoryId uint `p:"cate"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field CategoryId should be CategoryID

// 获取内容列表
type ContentGetListReq struct {
ContentGetListInput
CategoryId uint `p:"cate"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field CategoryId should be CategoryID

Page int
Size int
Sort int
UserId uint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field UserId should be UserID

// 获取内容列表
type ContentGetListInput struct {
Type string
CategoryId uint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field CategoryId should be CategoryID

package gf

const VERSION = "v1.16.0"
const VERSION = "v1.16.4"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const VERSION should have comment or be unexported

@gqcn
Copy link
Member

gqcn commented Jun 28, 2021

@qinyuguang I created PR #1316 from your branch, so I close this one.

@gqcn gqcn closed this Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants