reflectx.TypeFor => reflect.TypeFor
Since go1.22 it is now in the standard library and is removed from a future versio from pkglib
This commit is contained in:
parent
ee2f6e08c6
commit
84799afda2
9 changed files with 19 additions and 19 deletions
|
|
@ -2,12 +2,12 @@ package policy
|
|||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ var (
|
|||
func (pol *Policy) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Name: models.GrantTable,
|
||||
Model: reflectx.TypeFor[models.Grant](),
|
||||
Model: reflect.TypeFor[models.Grant](),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package tokens
|
|||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/tkw1536/pkglib/password"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ var (
|
|||
func (tok *Tokens) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Name: models.TokensTable,
|
||||
Model: reflectx.TypeFor[models.Token](),
|
||||
Model: reflect.TypeFor[models.Token](),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"image/png"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
|
|
@ -15,7 +16,6 @@ import (
|
|||
"github.com/pquerna/otp"
|
||||
"github.com/pquerna/otp/totp"
|
||||
"github.com/tkw1536/pkglib/password"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ var ErrUserNotFound = errors.New("user not found")
|
|||
func (auth *Auth) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Name: models.UserTable,
|
||||
Model: reflectx.TypeFor[models.User](),
|
||||
Model: reflect.TypeFor[models.User](),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import (
|
|||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/status"
|
||||
"github.com/tkw1536/pkglib/collection"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
)
|
||||
|
||||
// Logger is responsible for logging backups and snapshots
|
||||
|
|
@ -28,7 +28,7 @@ var (
|
|||
|
||||
func (*Logger) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeFor[models.Export](),
|
||||
Model: reflect.TypeFor[models.Export](),
|
||||
Name: models.ExportTable,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package meta
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
)
|
||||
|
||||
// Component meta is responsible for managing metadata per WissKI Instance
|
||||
|
|
@ -27,7 +27,7 @@ var (
|
|||
|
||||
func (*Meta) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeFor[models.Metadatum](),
|
||||
Model: reflect.TypeFor[models.Metadatum](),
|
||||
Name: models.MetadataTable,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import (
|
|||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/assets"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ func (rf RuntimeFlags) TookHTML() template.HTML {
|
|||
return template.HTML(fmt.Sprintf("<time datetime=\"P%.3f\">%s</time>", took.Seconds(), took))
|
||||
}
|
||||
|
||||
var runtimeFlagsName = reflectx.TypeFor[RuntimeFlags]().Name()
|
||||
var runtimeFlagsName = reflect.TypeFor[RuntimeFlags]().Name()
|
||||
|
||||
// Clone clones this flags
|
||||
func (flags Flags) Clone() Flags {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"html/template"
|
||||
"reflect"
|
||||
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
|
|
@ -21,7 +20,7 @@ type Parsed[C any] struct {
|
|||
// If base is not nil, every template associated with the base template is copied into the given template.
|
||||
// Functions will be applied on creation time to represent the context for the given template.
|
||||
func Parse[C any](name string, source []byte, base *template.Template, funcs ...FlagFunc) Parsed[C] {
|
||||
tp := reflectx.TypeFor[C]()
|
||||
tp := reflect.TypeFor[C]()
|
||||
|
||||
// determine if we have an embedded field in the struct
|
||||
var hasEmbed bool
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package sql
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
)
|
||||
|
||||
// This file defines additional tables used by multiple components
|
||||
|
|
@ -18,7 +19,7 @@ var (
|
|||
|
||||
func (*InstanceTable) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeFor[models.Instance](),
|
||||
Model: reflect.TypeFor[models.Instance](),
|
||||
Name: models.InstanceTable,
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +34,7 @@ var (
|
|||
|
||||
func (*LockTable) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeFor[models.Lock](),
|
||||
Model: reflect.TypeFor[models.Lock](),
|
||||
Name: models.LockTable,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ package sshkeys
|
|||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/gliderlabs/ssh"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
)
|
||||
|
||||
func (ssh2 *SSHKeys) TableInfo() component.TableInfo {
|
||||
return component.TableInfo{
|
||||
Model: reflectx.TypeFor[models.Keys](),
|
||||
Model: reflect.TypeFor[models.Keys](),
|
||||
Name: models.KeysTable,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue