genericcrud_repositories_gorm

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[T any](model *T, databaseInstance *gorm.DB) (T, error)

func CreateBatch

func CreateBatch[T any](models []T, databaseInstance *gorm.DB) ([]T, error)

func DeleteHardById

func DeleteHardById[T any](databaseInstance *gorm.DB, id string) (int64, error)

func DeletePermanentById

func DeletePermanentById[T any](databaseInstance *gorm.DB, id string) (int64, error)

func DeleteSoftById

func DeleteSoftById[T any](databaseInstance *gorm.DB, id string) (int64, error)

func GetAll

func GetAll[T any](databaseInstance *gorm.DB) ([]T, error)

func GetAllByFields

func GetAllByFields[T any](databaseInstance *gorm.DB, queryMap map[string]interface{}, preloads ...string) ([]T, error)

func GetOneById

func GetOneById[T any](databaseInstance *gorm.DB, id string, preloads ...string) (T, error)

func GetOneByModelPropertiesCheckIdPresence

func GetOneByModelPropertiesCheckIdPresence[T any](databaseInstance *gorm.DB, queryMap map[string]interface{}) (T, error)

func GetOneSoftDeletedById

func GetOneSoftDeletedById[T any](databaseInstance *gorm.DB, id string, preloads ...string) (T, error)

func PatchById

func PatchById[T any](databaseInstance *gorm.DB, id, columnName string, value interface{}) (T, error)

func SetPagination

func SetPagination(limit, page int, sort string)

func UpdateById

func UpdateById[T any](databaseInstance *gorm.DB, t T, id string) (T, error)

Types

type Pagination

type Pagination struct {
	Limit int    `json:"limit"`
	Page  int    `json:"page"`
	Sort  string `json:"sort"`
}

type PathParams

type PathParams struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

Jump to

Keyboard shortcuts

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