Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FieldsStr/FieldsExStr字段获取

  1. FieldsStr

...

  1.  用于获取指定表的字段,并可给定字段前缀,字段之间使用","符号连接成字符串返回;
  2. FieldsExStr

...

  1.  用于获取指定表中例外的字段,并可给定字段前缀,字段之间使用","符号连接成字符串返回;

FieldsStr示例

  1. 假如user表有4个字段uid, nickname, passport, password
  2. 查询字段

    Code Block
    languagego
    // uid,nickname,passport,password

...

  1. 
    g.

...

  1. Model("user").FieldsStr()

...


  1. 查询字段给指定前缀

    Code Block
    languagego
  1. // gf_uid,gf_nickname,gf_passport,gf_password

...

  1. 
    g.

...

  1. Model("user").FieldsStr("gf_")


FieldsExStr示例

  1. 假如user表有4个字段uid, nickname, passport, password
  2. 查询字段排除

    Code Block
    languagego
    // uid,nickname

...

  1. 
    g.

...

  1. Model("user").FieldsExStr("passport, password")


  2. 查询字段排除并给定前缀

    Code Block
    languagego
    // gf_uid,gf_nickname

...

  1. 
    g.

...

  1. Model("user").FieldsExStr("passport, password", "gf_")







Panel
titleContent Menu

Table of Contents