This is a creation in Article, where the information may have evolved or changed.
Package Dalimport ( "Encoding/json" "StrConv" "Strings" "Github.com/astaxie/beego/orm" _ "github.com/ Go-sql-driver/mysql ") type Automethod struct { actionid int ' orm:" Pk;auto;column (ActionId) "' actionname string ' orm: ' Size (actionname) ' actionarg String ' orm: ' size (+); column (Actionarg) "' actiontype int ' orm:" size (one); column ( ActionType) "' methodrunname string ' orm:" size (n); column (Methodrunname) "' assemblyid int ' orm: "size (one); column (Assemblyid)" ' classname string ' orm: "Siz The column (ClassName) "' subactionid int ' orm:" size (one); column (Subactionid) "' actionruntime string ' orm: ' Size, column (actionruntime) '}func init () { orm. Registermodelwithprefix ("", New (Automethod)) orm. Registerdriver ("MySQL", Orm.) Drmysql) orm. RegisterDatabase ("Default", "MySQL", "root:123456@tcp (10.101.42.64:3306)/mytest?charset=utf8")}func Printactionjson () interface{} { o: = orm. Neworm () o.using ("MyTest") var Actioninfos []*automethod sel: = o.querytable ("Automethod") count, err: = sel. All (&actioninfos) if err! = Nil { return "Number of Bars" + string (count) + Err. Error () } //json convert jsondata, err: = json. Marshal (Actioninfos) if err! = Nil { return Err. Error () } newdata: = Make ([]automethod, Len (actioninFOS)) json. Unmarshal (Jsondata, &newdata) return string (jsondata)}func Printactionmodel () interface {} { o: = orm. Neworm () o.using ("MyTest") var Actioninfos []*automethod sel: = o.querytable ("Automethod") count, err: = sel. All (&actioninfos) if err! = Nil { return "Number of Bars" + string (count) + Err. Error () } //json convert jsondata, err: = json. Marshal (Actioninfos) if err! = Nil { return Err. Error () } newdata: = Make ([]automethod, Len (Actioninfos)) json. Unmarshal (Jsondata, &newdata) return actioninfos}func PrintActionIdAndName () INTERFACe{} { o: = orm. Neworm () o.using ("MyTest") var actionids []int var actionnames []string raw: = O.raw ("Select Actionid,actionname from Automethod") num, err: = Raw. QueryRows (&actionids, &actionnames) var rowsdata = make ([]string, num, +) if Err = = Nil { for I: = Int64 (0); i < num; i++ {  ; rowsdata[i] = StrConv. Itoa (Actionids[i]) + actionnames[i] } return strings. Join (Rowsdata, ",") } return err. Error ()}