question

package
v0.0.0-...-f27ef36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2020 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Table is the table name of gf_question.
	Table = "gf_question"
	// Model is the model object of gf_question.
	Model = &arModel{g.DB("default").Table(Table).Safe()}
	// Columns defines and stores column names for table gf_question.
	Columns = struct {
		Id       string //
		Key      string // 唯一键名,用于程序硬编码
		Cid      string // 栏目ID
		Uid      string // 用户ID
		AdoptId  string // 采纳的回复ID
		Title    string // 标题
		Content  string // 内容
		Sort     string // 排序,数值越低越靠前,默认为添加时的时间戳,可用于置顶
		Brief    string // 摘要
		Thumb    string // 缩略图
		Tags     string // 标签名称列表(以#号分割)
		Referer  string // 内容来源,例如github/gitee
		Status   string // 状态\n0: 禁用\n1: 正常
		View     string // 浏览数量
		Zan      string //
		Cai      string //
		CreateAt string // 创建时间
		UpdateAt string // 修改时间
	}{
		Id:       "id",
		Key:      "key",
		Cid:      "cid",
		Uid:      "uid",
		AdoptId:  "adopt_id",
		Title:    "title",
		Content:  "content",
		Sort:     "sort",
		Brief:    "brief",
		Thumb:    "thumb",
		Tags:     "tags",
		Referer:  "referer",
		Status:   "status",
		View:     "view",
		Zan:      "zan",
		Cai:      "cai",
		CreateAt: "create_at",
		UpdateAt: "update_at",
	}
)

Functions

func Delete

func Delete(where ...interface{}) (result sql.Result, err error)

Delete is a convenience method for Model.Delete.

func FindArray

func FindArray(fieldsAndWhere ...interface{}) ([]gdb.Value, error)

FindArray is a convenience method for Model.FindArray. See Model.FindArray.

func FindCount

func FindCount(where ...interface{}) (int, error)

FindCount is a convenience method for Model.FindCount. See Model.FindCount.

func FindValue

func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error)

FindValue is a convenience method for Model.FindValue. See Model.FindValue.

func Insert

func Insert(data ...interface{}) (result sql.Result, err error)

Insert is a convenience method for Model.Insert.

func InsertIgnore

func InsertIgnore(data ...interface{}) (result sql.Result, err error)

InsertIgnore is a convenience method for Model.InsertIgnore.

func Replace

func Replace(data ...interface{}) (result sql.Result, err error)

Replace is a convenience method for Model.Replace.

func Save

func Save(data ...interface{}) (result sql.Result, err error)

Save is a convenience method for Model.Save.

func Update

func Update(dataAndWhere ...interface{}) (result sql.Result, err error)

Update is a convenience method for Model.Update.

Types

type Entity

type Entity struct {
	Id       uint        `orm:"id,primary" json:"id"`        //
	Key      string      `orm:"key"        json:"key"`       // 唯一键名,用于程序硬编码
	Cid      uint        `orm:"cid"        json:"cid"`       // 栏目ID
	Uid      uint        `orm:"uid"        json:"uid"`       // 用户ID
	AdoptId  uint        `orm:"adopt_id"   json:"adopt_id"`  // 采纳的回复ID
	Title    string      `orm:"title"      json:"title"`     // 标题
	Content  string      `orm:"content"    json:"content"`   // 内容
	Sort     uint        `orm:"sort"       json:"sort"`      // 排序,数值越低越靠前,默认为添加时的时间戳,可用于置顶
	Brief    string      `orm:"brief"      json:"brief"`     // 摘要
	Thumb    string      `orm:"thumb"      json:"thumb"`     // 缩略图
	Tags     string      `orm:"tags"       json:"tags"`      // 标签名称列表(以#号分割)
	Referer  string      `orm:"referer"    json:"referer"`   // 内容来源,例如github/gitee
	Status   uint        `orm:"status"     json:"status"`    // 状态\n0: 禁用\n1: 正常
	View     uint        `orm:"view"       json:"view"`      // 浏览数量
	Zan      uint        `orm:"zan"        json:"zan"`       //
	Cai      uint        `orm:"cai"        json:"cai"`       //
	CreateAt *gtime.Time `orm:"create_at"  json:"create_at"` // 创建时间
	UpdateAt *gtime.Time `orm:"update_at"  json:"update_at"` // 修改时间
}

Entity is the golang structure for table gf_question.

func FindAll

func FindAll(where ...interface{}) ([]*Entity, error)

FindAll is a convenience method for Model.FindAll. See Model.FindAll.

func FindOne

func FindOne(where ...interface{}) (*Entity, error)

FindOne is a convenience method for Model.FindOne. See Model.FindOne.

func (*Entity) Delete

func (r *Entity) Delete() (result sql.Result, err error)

Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.

func (*Entity) GetTags

func (r *Entity) GetTags() []string

获得问答的标签列表

func (*Entity) Insert

func (r *Entity) Insert() (result sql.Result, err error)

Inserts does "INSERT...INTO..." statement for inserting current object into table.

func (*Entity) InsertIgnore

func (r *Entity) InsertIgnore() (result sql.Result, err error)

InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.

func (*Entity) OmitEmpty

func (r *Entity) OmitEmpty() *arModel

OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.

func (*Entity) Replace

func (r *Entity) Replace() (result sql.Result, err error)

Replace does "REPLACE...INTO..." statement for inserting current object into table. If there's already another same record in the table (it checks using primary key or unique index), it deletes it and insert this one.

func (*Entity) Save

func (r *Entity) Save() (result sql.Result, err error)

Save does "INSERT...INTO..." statement for inserting/updating current object into table. It updates the record if there's already another same record in the table (it checks using primary key or unique index).

func (*Entity) Update

func (r *Entity) Update() (result sql.Result, err error)

Update does "UPDATE...WHERE..." statement for updating current object from table. It updates the record if there's already another same record in the table (it checks using primary key or unique index).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL