2023-02-10 13:23:30 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
2023-02-22 08:53:53 +00:00
|
|
|
type UniversalDb[T any] struct {
|
|
|
|
selects QuerySelect[T]
|
|
|
|
gets QueryGet[T]
|
2023-02-10 13:23:30 +00:00
|
|
|
}
|
|
|
|
|
2023-02-22 08:53:53 +00:00
|
|
|
func (u *UniversalDb[T]) Select(ctx context.Context, s string, a ...any) ([]T, error) {
|
|
|
|
return u.selects(ctx, s, a...)
|
2023-02-10 13:23:30 +00:00
|
|
|
}
|
|
|
|
|
2023-02-22 08:53:53 +00:00
|
|
|
func (u *UniversalDb[T]) Get(ctx context.Context, s string, a ...any) (T, error) {
|
|
|
|
return u.gets(ctx, s, a...)
|
2023-02-10 13:23:30 +00:00
|
|
|
}
|