mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
set profile attr for columnLabel
This commit is contained in:
parent
318a8a9f19
commit
7979b4d69b
2 changed files with 16 additions and 10 deletions
2
cache.go
2
cache.go
|
|
@ -271,7 +271,7 @@ func encodePair(p Pair) *internal.Pair {
|
|||
|
||||
func decodePair(pb *internal.Pair) Pair {
|
||||
return Pair{
|
||||
ID: pb.Key,
|
||||
ID: pb.Key,
|
||||
Count: pb.Count,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
executor.go
24
executor.go
|
|
@ -772,21 +772,27 @@ func (e *Executor) executeBulkSetBitmapAttrs(ctx context.Context, db string, cal
|
|||
|
||||
// executeSetProfileAttrs executes a SetProfileAttrs() call.
|
||||
func (e *Executor) executeSetProfileAttrs(ctx context.Context, db string, c *pql.Call, opt *ExecOptions) error {
|
||||
id, ok := c.Args["id"].(uint64)
|
||||
if !ok {
|
||||
return errors.New("SetProfileAttrs() id required")
|
||||
}
|
||||
|
||||
// Copy args and remove reserved fields.
|
||||
attrs := pql.CopyArgs(c.Args)
|
||||
delete(attrs, "id")
|
||||
|
||||
// Retrieve database.
|
||||
d := e.Index.DB(db)
|
||||
if d == nil {
|
||||
return ErrDatabaseNotFound
|
||||
}
|
||||
|
||||
id, ok := c.Args["id"].(uint64)
|
||||
if !ok {
|
||||
// Retrieve columnLabel
|
||||
columnLabel := d.columnLabel
|
||||
col, ok := c.Args[columnLabel].(uint64)
|
||||
if !ok {
|
||||
return errors.New("SetProfileAttrs() id required")
|
||||
}
|
||||
id = col
|
||||
}
|
||||
|
||||
// Copy args and remove reserved fields.
|
||||
attrs := pql.CopyArgs(c.Args)
|
||||
delete(attrs, "id")
|
||||
|
||||
// Set attributes.
|
||||
if err := d.ProfileAttrStore().SetAttrs(id, attrs); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue