[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find features d... #43
3 changed files with 6 additions and 6 deletions
|
|
@ -266,7 +266,7 @@ func fluxTime(value string) (time.Time, error) {
|
|||
if value == "" {
|
||||
return time.Time{}, core.E("store.fluxTime", "range value is empty", nil)
|
||||
}
|
||||
value = firstString(core.Split(value, ","))
|
||||
value = firstOrEmptyString(core.Split(value, ","))
|
||||
value = core.Trim(value)
|
||||
if core.HasPrefix(value, "time(v:") && core.HasSuffix(value, ")") {
|
||||
value = core.Trim(core.TrimSuffix(core.TrimPrefix(value, "time(v:"), ")"))
|
||||
|
|
|
|||
6
scope.go
6
scope.go
|
|
@ -172,13 +172,13 @@ func (scopedStore *ScopedStore) Count(group string) (int, error) {
|
|||
// Usage example: `keyCount, err := scopedStore.CountAll("config")`
|
||||
// Usage example: `keyCount, err := scopedStore.CountAll()`
|
||||
func (scopedStore *ScopedStore) CountAll(groupPrefix ...string) (int, error) {
|
||||
return scopedStore.store.CountAll(scopedStore.namespacedGroup(firstString(groupPrefix)))
|
||||
return scopedStore.store.CountAll(scopedStore.namespacedGroup(firstOrEmptyString(groupPrefix)))
|
||||
}
|
||||
|
||||
// Usage example: `groupNames, err := scopedStore.Groups("config")`
|
||||
// Usage example: `groupNames, err := scopedStore.Groups()`
|
||||
func (scopedStore *ScopedStore) Groups(groupPrefix ...string) ([]string, error) {
|
||||
groupNames, err := scopedStore.store.Groups(scopedStore.namespacedGroup(firstString(groupPrefix)))
|
||||
groupNames, err := scopedStore.store.Groups(scopedStore.namespacedGroup(firstOrEmptyString(groupPrefix)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ func (scopedStore *ScopedStore) Groups(groupPrefix ...string) ([]string, error)
|
|||
func (scopedStore *ScopedStore) GroupsSeq(groupPrefix ...string) iter.Seq2[string, error] {
|
||||
return func(yield func(string, error) bool) {
|
||||
namespacePrefix := scopedStore.namespacePrefix()
|
||||
for groupName, err := range scopedStore.store.GroupsSeq(scopedStore.namespacedGroup(firstString(groupPrefix))) {
|
||||
for groupName, err := range scopedStore.store.GroupsSeq(scopedStore.namespacedGroup(firstOrEmptyString(groupPrefix))) {
|
||||
if err != nil {
|
||||
if !yield("", err) {
|
||||
return
|
||||
|
|
|
|||
4
store.go
4
store.go
|
|
@ -372,7 +372,7 @@ func (storeInstance *Store) Groups(groupPrefix ...string) ([]string, error) {
|
|||
// Usage example: `for tenantGroupName, err := range storeInstance.GroupsSeq("tenant-a:") { if err != nil { break }; fmt.Println(tenantGroupName) }`
|
||||
// Usage example: `for groupName, err := range storeInstance.GroupsSeq() { if err != nil { break }; fmt.Println(groupName) }`
|
||||
func (storeInstance *Store) GroupsSeq(groupPrefix ...string) iter.Seq2[string, error] {
|
||||
actualGroupPrefix := firstString(groupPrefix)
|
||||
actualGroupPrefix := firstOrEmptyString(groupPrefix)
|
||||
return func(yield func(string, error) bool) {
|
||||
var rows *sql.Rows
|
||||
var err error
|
||||
|
|
@ -412,7 +412,7 @@ func (storeInstance *Store) GroupsSeq(groupPrefix ...string) iter.Seq2[string, e
|
|||
}
|
||||
}
|
||||
|
||||
func firstString(values []string) string {
|
||||
func firstOrEmptyString(values []string) string {
|
||||
if len(values) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue