crud_module

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Unlicense Imports: 6 Imported by: 0

README

Create CRDU module


Simple module to standarize the creation and minimal configuration for CRUDs

  • this module can be integrated to all libraries internal for MecuateAstrophytum with minimal impact
  • this module uses GorilaMux
  • this module is intended to be used whithin GO version 18.1.x

install the module

go get github.com/Mecuate/crud_module

Documentation

Index

Constants

View Source
const DEFAULT_LOG_ADDRESS = "0x0000f.log"

Variables

View Source
var LoggerAddress string = DEFAULT_LOG_ADDRESS
View Source
var RegistredMethods = []string{
	"CREATE",
	"READ",
	"UPDATE",
	"DELETE",
	"GET",
	"POST",
	"PUT",
	"PATCH",
	"CONNECT",
	"TRACE",
}
View Source
var Version versionType = "0.0.3"

Functions

func CreateMultiHandlerCRUD added in v0.0.2

func CreateMultiHandlerCRUD(r MuxRouter, rawPath string, handlers IndividualCRUDHandlers)

func CreateSingleHandlerCRUD added in v0.0.2

func CreateSingleHandlerCRUD(r MuxRouter, rawPath string, handler HandleFunc)

func DefaultLockedMethod added in v0.0.2

func DefaultLockedMethod(w http.ResponseWriter, r *http.Request)

func FindMethod added in v0.0.2

func FindMethod(v ReqVerb) ([]string, error)

func IsWordRestricted added in v0.0.2

func IsWordRestricted(path string) bool

func LockAllOtherMethods added in v0.0.2

func LockAllOtherMethods(r MuxRouter, path string, excluded []string)

func Log

func Log(message string)

func LogVersion added in v0.0.2

func LogVersion()

func RemoveItemsFromArray added in v0.0.2

func RemoveItemsFromArray(arr []string, itemsToRemove []string) []string

func SetLogFile added in v0.0.2

func SetLogFile(fileURL string)

func SetLogMode added in v0.0.2

func SetLogMode(mode LoggLevel)

func VetPath added in v0.0.2

func VetPath(rawPath string) string

Types

type HandleFunc added in v0.0.2

type HandleFunc func(w http.ResponseWriter, r *http.Request)

type IndividualCRUDHandlers added in v0.0.2

type IndividualCRUDHandlers map[ReqVerb]HandleFunc

type LoggLevel added in v0.0.2

type LoggLevel int64
const (
	ERROR LoggLevel = iota
	DEBUG
	DEVELOP
)
var LogLevelSetup LoggLevel = ERROR

type MuxRouter added in v0.0.2

type MuxRouter struct {
	Router *mux.Router
}

type ReqVerb added in v0.0.2

type ReqVerb int64
const (
	CREATE ReqVerb = iota
	READ
	UPDATE
	DELETE
	GET
	POST
	PUT
	PATCH
	CONNECT
	TRACE
	CRUD
)

Jump to

Keyboard shortcuts

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