core

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 3 Imported by: 0

README

ao-concepts core module

CI codecov

This module provides the following functionalities:

  • a http webserver, based on Gin Web Framework
  • a basic http client
  • a websocket server that uses the same api as the http webserver. It uses a radix tree router
  • a websocket client that uses the same api as the websocket server. It uses a radix tree router
  • a tiny service container that uses reflection
  • some useful application helpers:
    • logging
    • reading data from files into structs and writing data from structs into files (primarily for configuration purposes)
    • database acces and transactions (based on gorm)
    • struct reflection
    • struct validation

Information

The ao-concepts ecosystem is still under active development and therefore the API of this module may have breaking changes until there is a first stable release.

If you are interested in contributing to this project, feel free to open a issue to discus a new feature, enhancement or improvement. If you found a bug or security vulnerability in this package, please start a issue, or open a PR against master.

Todos

  • Documentation

Installation

go get -u github.com/ao-concepts/core

Used packages

This project uses some really great packages. Please make sure to check them out!

Package Usage
github.com/dchest/uniuri URL friendly random strings
github.com/gin-contrib/cors CORS middleware, used in dev mode
github.com/gin-gonic/gin Base of the http server
github.com/go-playground/validator/v10 Struct validation
github.com/gorilla/sessions HTTP sessions
github.com/gorilla/websocket Websockets
github.com/mitchellh/mapstructure Configuration
github.com/golang-migrate/migrate/v4 Database Migrations
github.com/pkg/errors Error handling
github.com/rs/zerolog The default logger
github.com/spf13/viper Configuration file access
github.com/stretchr/testify Testing
gorm.io/gorm Database access

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Container service.Container

Container global service container

Functions

func AddService

func AddService(service interface{}) (err error)

AddService a service to the container

func GetService

func GetService(s interface{}) (err error)

GetService a service from the container

func HasService

func HasService(service interface{}) (hasService bool)

HasService check if the service exists in the container

func NewContainer

func NewContainer() (r service.Container)

NewContainer constructor

func NewHTTPClient

func NewHTTPClient(config *http.ClientConfig) (c *http.Client)

NewHTTPClient constructor

func NewHTTPServer

func NewHTTPServer(config *http.ServerConfig, c service.Container) (s *http.Server, err error)

NewHTTPServer constructor

func NewWebsocketClient

func NewWebsocketClient(c service.Container) (*websocket.Client, error)

NewWebsocketClient constructor

func NewWebsocketServer

func NewWebsocketServer(config *websocket.ServerConfig, c service.Container) (s *websocket.Server, err error)

NewWebsocketServer constructor

Types

This section is empty.

Directories

Path Synopsis
mock
pkg
log

Jump to

Keyboard shortcuts

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