Skip to content

Commit

Permalink
Added Distinct, InsertRecord, GetSorted in embed clover and tiedot im…
Browse files Browse the repository at this point in the history
…plementations
  • Loading branch information
vkuznet committed Dec 6, 2024
1 parent 54c636a commit 10101e2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions embed/clover/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,23 @@ func Remove(dbname, collname string, spec map[string]any) error {
}
return nil
}

// Distinct gets number records from document-oriented db
func Distinct(dbname, collname, field string) ([]any, error) {
var out []any
var err error
// Not implemented yet
return out, err
}

// InsertRecord insert record with given spec to document-oriented db
func InsertRecord(dbname, collname string, rec map[string]any) error {
var records []map[string]any
records = append(records, rec)
return Upsert(dbname, collname, "", records)
}

// GetSorted fetches records from document-oriented db sorted by given key with specific order
func GetSorted(dbname, collname string, spec map[string]any, skeys []string, sortOrder, idx, limit int) []map[string]any {
return Get(dbname, collname, spec, idx, limit)
}
20 changes: 20 additions & 0 deletions embed/tiedot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,23 @@ func Remove(dbname, collname string, spec map[string]any) error {
var err error
return err
}

// Distinct gets number records from document-oriented db
func Distinct(dbname, collname, field string) ([]any, error) {
var out []any
var err error
// Not implemented yet
return out, err
}

// InsertRecord insert record with given spec to document-oriented db
func InsertRecord(dbname, collname string, rec map[string]any) error {
var records []map[string]any
records = append(records, rec)
return Upsert(dbname, collname, "", records)
}

// GetSorted fetches records from document-oriented db sorted by given key with specific order
func GetSorted(dbname, collname string, spec map[string]any, skeys []string, sortOrder, idx, limit int) []map[string]any {
return Get(dbname, collname, spec, idx, limit)
}

0 comments on commit 10101e2

Please sign in to comment.