Documentation ¶
Index ¶
- func GenerateObjectID() (primitive.ObjectID, error)
- func ObjectIDToUUIDBytes(oi primitive.ObjectID) (res [16]byte, err error)
- type Connection
- type Repo
- func (r *Repo[T, K]) ApplyId(data *T) (err error)
- func (r *Repo[T, K]) Delete(data T) (count int64, err error)
- func (r *Repo[T, K]) DeleteById(id K) (count int64, err error)
- func (r *Repo[T, K]) Find(filter map[string]interface{}) (result []T, err error)
- func (r *Repo[T, K]) Get(id K) (data T, err error)
- func (r *Repo[T, K]) IdToUUIDBytes(id K) (res [16]byte, err error)
- func (r *Repo[T, K]) Insert(data T) (id K, err error)
- func (r *Repo[T, K]) New(ids ...K) (data T, err error)
- func (r *Repo[T, K]) Save(data T) (uid K, err error)
- func (r *Repo[T, K]) SetTimeout(timeout int)
- func (r *Repo[T, K]) Update(id K, data T) (uid K, err error)
- type RepoConfig
- type RepoIdGeneratorFunc
- type RepoToUUIDBytesFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateObjectID ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
type Repo ¶
func NewRepo ¶
func NewRepo[T any, K any](connection *Connection, config RepoConfig[K]) *Repo[T, K]
func NewRepoWithObjectID ¶
func NewRepoWithObjectID[T any, K any](connection *Connection, collection string) *Repo[T, K]
func (*Repo[T, K]) DeleteById ¶
func (*Repo[T, K]) IdToUUIDBytes ¶
func (*Repo[T, K]) SetTimeout ¶
type RepoConfig ¶
type RepoConfig[K any] struct { Collection string GenerateID RepoIdGeneratorFunc[K] IDToUUIDBytes RepoToUUIDBytesFunc[K] }
type RepoIdGeneratorFunc ¶
type RepoToUUIDBytesFunc ¶
Click to show internal directories.
Click to hide internal directories.