repository

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

README

repository

Generic Repository for gorm ORM

Purpose

Trying to avoid to write crud operation everytime by making it a package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Migrate(ctx context.Context, models interface{}) (bool, error)
	Create(ctx context.Context, models interface{}) (interface{}, error)
	GetRows(ctx context.Context, models interface{}) (interface{}, error)
	Get(ctx context.Context, models interface{}, fields map[string]interface{}) (interface{}, error)
	GetAll(ctx context.Context, models interface{}) (interface{}, error)
	First(ctx context.Context, models interface{}, id string) (interface{}, error)
	FindAll(ctx context.Context, models interface{}, query string) (interface{}, error)
	Update(ctx context.Context, models interface{}, id string, fields map[string]interface{}) (bool, error)
	Updates(ctx context.Context, model, updaded interface{}) error
	Delete(ctx context.Context, models interface{}, id string) (bool, error)
}

Generic repo for our differents models

func NewRepo

func NewRepo(db *gorm.DB, logger log.Logger) Repository

Jump to

Keyboard shortcuts

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