Esempio n. 1
0
func (p *SysTable) Exec() {
	p.session, p.login, p.tx, p.ctx = util.GetSessionLogin(p.context, "sysTable")
	defer dfweb.ErrorRecover(p.context, p.tx)
	json := dfweb.GetBodyJson(p.context)
	operationType := (json["operationType"]).(string)
	var data map[string]interface{}
	if df.GetType(json["data"])[0:3] == "map" {
		data = (json["data"]).(map[string]interface{})
	}
	var id float64
	if df.GetType(json["data"]) == "float64" {
		id = (json["data"]).(float64)
	}
	switch operationType {
	case "fetch":
		p.Fetch(data)
	case "add":
		p.Insert(data)
	case "update":
		p.Update(data)
	case "remove":
		p.Delete(id)
	case "getdbs":
		p.GetDbs()
	default:
		panic("SysTable operationType が無効です。 :" + operationType)
	}
}
Esempio n. 2
0
func (p *Customer) Exec() {
	p.session, p.login, p.tx, p.ctx = util.GetSessionLogin(p.context, "godbfexan")
	defer dfweb.ErrorRecover(p.context, p.tx)
	json := dfweb.GetBodyJson(p.context)
	transactions := json["transactions"]
	if transactions != nil {
		p.Transaction(transactions.([]interface{}))
		return
	}
	operationType := (json["operationType"]).(string)
	var data map[string]interface{}
	if df.GetType(json["data"])[0:3] == "map" {
		data = (json["data"]).(map[string]interface{})
	}
	var id float64
	if df.GetType(json["data"]) == "float64" {
		id = (json["data"]).(float64)
	}
	switch operationType {
	case "fetch":
		p.Fetch(data)
	case "add":
		p.Insert(data)
	case "update":
		p.Update(data)
	case "remove":
		p.Delete(id)
	default:
		panic("Customer operationType が無効です。 :" + operationType)
	}
}
Esempio n. 3
0
func MapToEntity(rmap map[string]interface{}, entity *df.Entity, table string, update bool) {
	meta := df.DBMetaProvider_I.TableDbNameInstanceMap[table]
	for propertyName := range rmap {
		colInfo := (*meta).GetColumnInfoByPropertyName(propertyName)
		if colInfo == nil {
			continue
		}
		value := rmap[propertyName]
		if value == nil {
			continue
		}
		argType := df.GetType(value)
		if argType == "string" {
			svalue := value.(string)
			if svalue == "" {
				EntitySetNull(entity, propertyName, colInfo, update)
				continue
			}
		}
		df.SetEntityValue(entity, propertyName,
			ConvFromWebData(value, colInfo, argType))
	}
}
Esempio n. 4
0
func ConvFromWebDataInd(arg interface{}, goType string) interface{} {
	colInfo := new(df.ColumnInfo)
	colInfo.GoType = goType
	return ConvFromWebData(arg, colInfo, df.GetType(arg))
}