Skip to content

tink3rlabs/magic

Repository files navigation

Tink3rlabs Magic

Go Report Card Go Reference License: MIT

Magic is a package containing implementation of common building blocks required when developing micro-services in go-lang.

Goals

The goal is to move all common functionality such as speaking with storage systems, performing leader election, checking the health of a micro-service, logging in text vs. JSON, etc. out of every micro-service's code base allowing the micro-service code to focus only on business logic.

Installation

go get github.com/tink3rlabs/magic@latest

Usage

Magic exposes multiple common functionalities each in it's own package.

Storage

This package contains everything needed to persist data in storage systems. For example to write data to an in-memory database you would instantiate the storage system as follows:

import (
  "embed"
  "fmt"

  "github.com/google/uuid"
  "github.com/tink3rlabs/magic/storage"
)

config := map[string]string{}
s, err := storage.StorageAdapterFactory{}.GetInstance(storage.MEMORY, config)

if err != nil {
  fmt.Println(err)
}

fmt.Println(s.Ping())

storage.NewDatabaseMigration(s).Migrate()

See more detailed examples in the examples folder

Leadership

TODO

Health

TODO

Logger

TODO

Middlewares

TODO

Types

TODO

Contributing

Please see CONTRIBUTING. Thank you, contributors!

License

Released under the MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages