common

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: CC0-1.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MYSQL_ENGINE    = "mysql"
	POSTGRES_ENGINE = "postgres"
)

Variables

View Source
var (
	ErrStructNotCompatible = errors.New("struct is not compatible")
	ErrIdParamIsRequired   = errors.New("parameter ID is required")
	ErrIdMustNumeric       = errors.New("ID must be defined as number")
	ErrPatch               = errors.New("error patch")
)

Functions

This section is empty.

Types

type HandlerCRUD

type HandlerCRUD interface {
	ReadHandler
	WriteHandler
}

type ReadHandler

type ReadHandler interface {
	GetList(w http.ResponseWriter, r *http.Request) *response.JSON
	GetDetailById(w http.ResponseWriter, r *http.Request) *response.JSON
}

type ReadRepo

type ReadRepo interface {
	GetList(ctx context.Context, opts *database.QueryOpts) error
	GetDetail(ctx context.Context, opts *database.QueryOpts) error
	GetDetailById(ctx context.Context, resultStruct interface{}, id interface{}, optionalTableName ...string) error
	Count(ctx context.Context, tableName string, reqData *database.TableRequest) (totalData, totalFiltered int, err error)
}

type RepoCRUD

type RepoCRUD interface {
	ReadRepo
	WriteRepo
}

type UsecaseCRUD

type UsecaseCRUD interface {
	GetList(ctx context.Context, requestData interface{}) (*database.SelectResponse, error)
	GetDetailById(ctx context.Context, id interface{}) (*database.SelectResponse, error)
	Insert(ctx context.Context, data interface{}) (*database.CUDResponse, error)
	Update(ctx context.Context, data interface{}) (*database.CUDResponse, error)
	Delete(ctx context.Context, id interface{}) (*database.CUDResponse, error)
}

type WriteHandler

type WriteHandler interface {
	Insert(w http.ResponseWriter, r *http.Request) *response.JSON
	Update(w http.ResponseWriter, r *http.Request) *response.JSON
	Delete(w http.ResponseWriter, r *http.Request) *response.JSON
}

type WriteRepo

type WriteRepo interface {
	Insert(ctx context.Context, data interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	BulkInsert(ctx context.Context, data interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	BulkUpdate(ctx context.Context, data interface{}, condition map[string][]interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	Update(ctx context.Context, data interface{}, condition map[string]interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	Upsert(ctx context.Context, data interface{}, condition map[string]interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	UpdateById(ctx context.Context, data interface{}, id interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	Delete(ctx context.Context, condition map[string]interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
	DeleteById(ctx context.Context, id interface{}, trx ...*sql.Tx) (*database.CUDResponse, error)
}

Jump to

Keyboard shortcuts

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