repos

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonJsonRepo deprecated

type CommonJsonRepo[T any] struct {
	Cfg  model.FileConfig
	Data T
	Err  error
}

Deprecated: use JsonDatasourceRepo one instead

func NewJsonRepository deprecated

func NewJsonRepository[T any](cfg model.FileConfig) *CommonJsonRepo[T]

Deprecated: use JsonDatasourceRepo one instead

func (*CommonJsonRepo[T]) Dispose

func (j *CommonJsonRepo[T]) Dispose() error

func (*CommonJsonRepo[T]) RepoImplName

func (j *CommonJsonRepo[T]) RepoImplName() scene.ImplName

func (*CommonJsonRepo[T]) Setup

func (j *CommonJsonRepo[T]) Setup() error

func (*CommonJsonRepo[T]) Status

func (j *CommonJsonRepo[T]) Status() error

type GormRepo

type GormRepo[T any] struct {
	*gorm.DB
}

func UseGormMysql

func UseGormMysql[T any](ds datasource.MysqlDataSource) (*GormRepo[T], error)

func (*GormRepo[T]) FindPagination

func (m *GormRepo[T]) FindPagination(scope func(db *gorm.DB) *gorm.DB, offset int, limit int) (result model.PaginationResult[T], err error)

type JsonDatasourceRepo

type JsonDatasourceRepo[T any] struct {
	Data T
	// contains filtered or unexported fields
}

func UseJsonDatasourceRepo

func UseJsonDatasourceRepo[T any](datasource datasource.JsonDataSource) *JsonDatasourceRepo[T]

func (*JsonDatasourceRepo[T]) LoadData

func (j *JsonDatasourceRepo[T]) LoadData() (T, error)

type MongoCollectionRepo deprecated

type MongoCollectionRepo[T any] struct {
	Cfg model.DatabaseConfig
	// contains filtered or unexported fields
}

Deprecated: use MongoDatasourceCollection instead

func NewMongoCollectionRepo

func NewMongoCollectionRepo[T any](cfg model.DatabaseConfig, collection string) *MongoCollectionRepo[T]

func (*MongoCollectionRepo[T]) Collection

func (m *MongoCollectionRepo[T]) Collection() *mongo.Collection

func (*MongoCollectionRepo[T]) Database

func (m *MongoCollectionRepo[T]) Database() *mongo.Database

func (*MongoCollectionRepo[T]) Dispose

func (m *MongoCollectionRepo[T]) Dispose() error

func (*MongoCollectionRepo[T]) FindOne

func (m *MongoCollectionRepo[T]) FindOne(filter interface{}) (T, error)

func (*MongoCollectionRepo[T]) FindPagination

func (m *MongoCollectionRepo[T]) FindPagination(filter interface{}, sort interface{}, offset int64, limit int64) (result []T, total int, err error)

func (*MongoCollectionRepo[T]) Status

func (m *MongoCollectionRepo[T]) Status() error

type MongoDatasourceCollection

type MongoDatasourceCollection[T any] struct {
	CollectionName string
	// contains filtered or unexported fields
}

func UseMongoDatasourceCollection

func UseMongoDatasourceCollection[T any](datasource datasource.MongoDataSource, coll string) *MongoDatasourceCollection[T]

func (*MongoDatasourceCollection[T]) Collection

func (m *MongoDatasourceCollection[T]) Collection() *mongo.Collection

func (*MongoDatasourceCollection[T]) FindOne

func (m *MongoDatasourceCollection[T]) FindOne(filter interface{}) (T, error)

func (*MongoDatasourceCollection[T]) FindPagination

func (m *MongoDatasourceCollection[T]) FindPagination(filter interface{}, sort interface{}, offset int64, limit int64) (result model.PaginationResult[T], err error)

func (*MongoDatasourceCollection[T]) Status

func (m *MongoDatasourceCollection[T]) Status() error

type MongoRepo deprecated

type MongoRepo struct {
	Cfg model.DatabaseConfig
	// contains filtered or unexported fields
}

Deprecated: use MongoDatasourceCollection instead

func NewMongoRepo

func NewMongoRepo(cfg model.DatabaseConfig) *MongoRepo

func (*MongoRepo) Database

func (m *MongoRepo) Database() *mongo.Database

func (*MongoRepo) Dispose

func (m *MongoRepo) Dispose() error

func (*MongoRepo) Status

func (m *MongoRepo) Status() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL