beego/beego · critical · ErrNotImplement

have not implement

Error message

have not implement

What it means

client/orm/orm_queryset.go:358: querySet.RowsToMap is a stub that unconditionally panics with ErrNotImplement. It is declared on the exported QuerySeter interface (mapping query rows into a map[string]interface{} keyed by one column), but no implementation exists anywhere in the package — the method body is only 'panic(ErrNotImplement)'. Any call always panics, regardless of driver or data.

Source

Thrown at client/orm/orm_queryset.go:358

// ValuesFlatWithCtx see ValuesFlat
func (o querySet) ValuesFlatWithCtx(ctx context.Context, result *ParamsList, expr string) (int64, error) {
	return o.orm.alias.DbBaser.ReadValues(ctx, o.orm.db, o, o.mi, o.cond, []string{expr}, result, o.orm.alias.TZ)
}

// RowsToMap query rows into map[string]interface with specify key and value column name.
// keyCol = "name", valueCol = "value"
// table data
// name  | value
// total | 100
// found | 200
//
//	to map[string]interface{}{
//		"total": 100,
//		"found": 200,
//	}
func (o querySet) RowsToMap(result *Params, keyCol, valueCol string) (int64, error) {
	panic(ErrNotImplement)
}

// RowsToStruct query rows into struct with specify key and value column name.
// keyCol = "name", valueCol = "value"
// table data
// name  | value
// total | 100
// found | 200
//
//	to struct {
//		Total int
//		Found int
//	}
func (o querySet) RowsToStruct(ptrStruct interface{}, keyCol, valueCol string) (int64, error) {
	panic(ErrNotImplement)
}

// create new QuerySeter.

View on GitHub (pinned to 939cfde380)

Solutions

  1. Replace RowsToMap with Values/ValuesList and build the map yourself (see exampleFix).
  2. For arbitrary SQL, use orm.NewOrm().Raw(...).QueryRows(&rows) into a []Params or use ValuesMap on the QuerySeter if the shape fits.
  3. Delete any call to RowsToMap/RowsToStruct from shared helpers so future callers cannot rediscover the panic.

Example fix

// before
var m Params
qs.RowsToMap(&m, "name", "value") // always panics: not implemented

// after
var rows []Params
if _, err := qs.Values(&rows, "name", "value"); err != nil { return err }
m := Params{}
for _, r := range rows {
    m[r["name"].(string)] = r["value"]
}
Defensive patterns

Strategy: fallback

Validate before calling

// There is nothing to validate: the call always panics. Detect and reject it early.
func rowsToMapSafe(qs orm.QuerySeter, keyCol, valueCol string) (Params, error) {
    // never call qs.RowsToMap — not implemented in beego v2
    var rows []Params
    if _, err := qs.Values(&rows, keyCol, valueCol); err != nil {
        return nil, err
    }
    out := Params{}
    for _, r := range rows {
        if k, ok := r[keyCol].(string); ok {
            out[k] = r[valueCol]
        }
    }
    return out, nil
}

Try / catch

Go: if third-party code may call it, recover and fall back: defer func() { if r := recover(); r != nil { if e, ok := r.(error); ok && errors.Is(e, orm.ErrNotImplement) { err = rowsToMapSafe(qs, keyCol, valueCol); return }; panic(r) } }()

Prevention

When it happens

Trigger: Calling qs.RowsToMap(&m, "name", "value") on any QuerySeter obtained from o.QueryTable(...). It panics immediately — there is no data-dependent path that avoids it.

Common situations: Porting code from beego v1 docs or other ORMs (e.g. Django-ish APIs) where a row-to-map helper existed; AI-assisted code or IDE autocomplete selecting RowsToMap because it appears in the QuerySeter interface; refactoring a Values() query into what looks like a cleaner helper.

Related errors


AI-assisted analysis of beego/beego@939cfde380 (2026-08-15). Data as JSON: /api/errors/9fa7e45d7e797b40. Report an issue: GitHub.