gam

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

gam

An analytics middleware for Go web servers

Install

TIP: If you want to use a specific version please refer releases and replace latest with the desired version.

go get -u https://github.com/Makepad-fr/gam@latest

Usage

First create a new instance of gam by using the gam.Init function

g, err := gam.Init("ch_username", "ch_password", "ch_hostname", "ch_port", "ch_database_name", "ch_table_name", true, true)

This will return an error if there's a connection issue or if the table names ch_table_name exists but have a different schema then the expected schema. Otherwise it will create an table named ch_table_name if it does not exists yet.

Then pass your handler function to the g.Middleware as you'd done with any middleware functions in go

h := g.Middleware(myHandlerFunc)

It will create you a http.Handler that you can pass to a http.ServerMux or http.Server using Handle method

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(username, password, hostname, port, databaseName, tableName string, ensureTableExistanceAndSchema, createTableIfNotExists bool) (gam, error)

Init creates a new gam structure by initialising the database connection

Types

This section is empty.

Jump to

Keyboard shortcuts

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