package models_func import ( "errors" e "github.com/dabory/abango-rest/etc" "github.com/go-xorm/xorm" ) type EtcSelect struct { // SelectName string `xorm:"VARCHAR(49)"` Value string `xorm:"VARCHAR(191)"` Caption string `xorm:"VARCHAR(191)"` } type EtcSelectPage struct { Page []EtcSelect } // type EtcPage struct { // Page []models_table.DbrEtc // } func EtcSelectGet(YDB *xorm.Engine, sel *EtcSelectPage, etcType string, selName string) error { // qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no") qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no") if err := qry.Find(&sel.Page); err == nil { e.FuncRun("234adsrared", e.CurrFuncName()) return nil } else { return errors.New(e.PageQryErr("ltrysgaera", e.CurrFuncName()+err.Error())) } // var t EtcPage // qry := *YDB.Table("dbr_etc").Where("etc_type='" + etcType + "' and select_name='" + selName + "'").Asc("sort_no") // if cnt, err := qry.FindAndCount(&t.Page); err == nil { // sel.Page = make([]EtcSelect, cnt) // for key, r := range t.Page { // sel.Page[key].Value = r.Value // sel.Page[key].Caption = r.Caption // } // e.FuncRun("cseldfsregas", e.CurrFuncName()+selName) // return nil // } else { // return errors.New(e.PageQryErr("rtyertyuery", e.CurrFuncName()+selName+err.Error())) // } }