core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCore

type AppCore[T dbtype] struct {
	Router   *mux.Router
	Database T
}

func (*AppCore[T]) AddRoute

func (app *AppCore[T]) AddRoute(path string, method MethodType, handler RequestHandlerFunction[T])

func (*AppCore[T]) ConfigureDatabase

func (app *AppCore[T]) ConfigureDatabase(dbName string, mongoURI string)

func (*AppCore[T]) ConfigureRouter

func (app *AppCore[T]) ConfigureRouter()

func (*AppCore[T]) Delete

func (app *AppCore[T]) Delete(path string, f func(w http.ResponseWriter, r *http.Request))

Delete wraps the router for DELETE method

func (*AppCore[T]) Get

func (app *AppCore[T]) Get(path string, f func(w http.ResponseWriter, r *http.Request))

func (*AppCore[T]) Post

func (app *AppCore[T]) Post(path string, f func(w http.ResponseWriter, r *http.Request))

Post wraps the router for POST method

func (*AppCore[T]) Put

func (app *AppCore[T]) Put(path string, f func(w http.ResponseWriter, r *http.Request))

Put wraps the router for PUT method

func (*AppCore[T]) Run

func (app *AppCore[T]) Run(host string)

type DatabaseType

type DatabaseType string
const (
	MongoDB   DatabaseType = "MongoDB"
	SqlServer DatabaseType = "SqlServer"
)

type MethodType

type MethodType int
const (
	GET    MethodType = 1
	POST   MethodType = 2
	PUT    MethodType = 3
	DELETE MethodType = 4
)

type MongoConfig

type MongoConfig struct {
	Database string
	MongoURI string
}

func (*MongoConfig) Configure

func (db *MongoConfig) Configure(dbName string, mongoURI string) *MongoConfig

func (*MongoConfig) Connect

func (db *MongoConfig) Connect() *mongo.Database

type RequestHandlerFunction

type RequestHandlerFunction[T dbtype] func(database T, w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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