Example #1
0
//---------------------------------------------------------- Set Field value
func _set(tblname string, rowname string, fieldname string, value string) {
	log.Println("tblname:", tblname, " rowname:", rowname, " fieldname:", fieldname, " value:", value)
	// store hashing
	h_rowname := naming.FNV1a(rowname)
	h_fieldname := naming.FNV1a(fieldname)
	h_tblname := naming.FNV1a(tblname)
	_hashtbl[h_rowname] = rowname
	_hashtbl[h_fieldname] = fieldname
	_hashtbl[h_tblname] = tblname

	//
	tbl := _tables[h_tblname]

	if tbl == nil {
		tbl = &Table{}
		tbl.Records = make(map[uint32]*Record)
		_tables[h_tblname] = tbl
	}

	rec := tbl.Records[h_rowname]
	if rec == nil {
		rec = &Record{}
		rec.Fields = make(map[uint32]string)
		tbl.Records[h_rowname] = rec
	}

	rec.Fields[h_fieldname] = value
}
Example #2
0
func _get(tblname string, rowname string, fieldname string) string {
	return _gethash(naming.FNV1a(tblname), naming.FNV1a(rowname), naming.FNV1a(fieldname))
}