add show course and map names

This commit is contained in:
Aleksandr Trushkin
2024-01-08 18:31:35 +03:00
parent 48f5d80f7a
commit 2c0564f68c
22 changed files with 166 additions and 90 deletions

View File

@ -11,7 +11,7 @@ import (
"time"
"git.loyso.art/frx/kurious/internal/common/errors"
"git.loyso.art/frx/kurious/pkg/slices"
"git.loyso.art/frx/kurious/internal/common/xslices"
"git.loyso.art/frx/kurious/pkg/xdefault"
"github.com/go-resty/resty/v2"
@ -52,8 +52,8 @@ func NewClient(ctx context.Context, log *slog.Logger, debug bool) (c *client, er
return nil, err
}
getQuerySet := func(fields []field) querySet {
items := slices.Map(fields, func(f field) string {
getQuerySet := func(fields []Field) querySet {
items := xslices.Map(fields, func(f Field) string {
return f.Value
})

View File

@ -39,7 +39,7 @@ type ReduxMetadata struct {
} `json:"data"`
}
type field struct {
type Field struct {
Name string `json:"name"`
Value string `json:"value"`
}
@ -51,7 +51,7 @@ type ReduxDictionaryContainer struct {
UserID string `json:"userId"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Fields []field `json:"fields"`
Fields []Field `json:"fields"`
}
type ReduxDictionaries struct {

View File

@ -27,6 +27,7 @@ type YDB struct {
DSN string
Auth YCAuth
ShutdownDuration time.Duration
DebugYDB bool
}
func (ydb *YDB) UnmarshalJSON(data []byte) error {

View File

@ -1,4 +1,4 @@
package xslice
package xslices
func Filter[T any](values []T, f func(T) bool) []T {
out := make([]T, 0, len(values))

View File

@ -1,9 +1,9 @@
package xslice_test
package xslices_test
import (
"testing"
"git.loyso.art/frx/kurious/internal/common/xslice"
"git.loyso.art/frx/kurious/internal/common/xslices"
)
func TestFilterInplace(t *testing.T) {
@ -43,7 +43,7 @@ func TestFilterInplace(t *testing.T) {
for _, tc := range tt {
tc := tc
t.Run(tc.name, func(t *testing.T) {
gotLen := xslice.FilterInplace(tc.in, tc.check)
gotLen := xslices.FilterInplace(tc.in, tc.check)
if gotLen != tc.expLen {
t.Errorf("exp %d got %d", tc.expLen, gotLen)
}

View File

@ -1,4 +1,4 @@
package xslice
package xslices
func ForEach[T any](items []T, f func(T)) {
for _, item := range items {

View File

@ -1,4 +1,4 @@
package xslice
package xslices
func Map[T, U any](in []T, f func(T) U) []U {
out := make([]U, len(in))