Created
May 3, 2018 19:43
-
-
Save siddontang/efa08d318244299097df0b0e6ad6774b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (db *fDB) Read(ctx context.Context, table string, key string, fields []string) (map[string][]byte, error) { | |
rowKey := db.getRowKey(table, key) | |
row, err := db.db.Transact(func(tr fdb.Transaction) (interface{}, error) { | |
f := tr.Get(fdb.Key(rowKey)) | |
return f.Get() | |
}) | |
if err != nil { | |
return nil, err | |
} else if row == nil { | |
return nil, nil | |
} | |
return db.r.Decode(row.([]byte), fields) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment