GithubHelp home page GithubHelp logo

donutloop / toolkit Goto Github PK

View Code? Open in Web Editor NEW
159.0 6.0 9.0 162 KB

Collection of useful patterns

License: MIT License

Go 98.76% Makefile 1.24%
message-bus api event-sourcing retry promise fifo-queue code-generation code-generator worker singleton

toolkit's Introduction

toolkit

Build Status Coverage Status Go Report Card

Introduction

These patterns can you use to solve common problems when designing an application or system.

Requirements

  • golang >=1.11.x - The Go Programming Language

Installation

go get github.com/donutloop/toolkit/{any_package}

Example

go get github.com/donutloop/toolkit/worker

Patterns

Examples

In each sub directory is a set of examples

Code generation

Currently, it's only compatiable with version 2.x.x

The code generation tool generates for a pattern an none generic version for spefici type

Supported pattern

Build

mkdir -p $GOPATH/src/github.com/donutloop/ && cd $GOPATH/src/github.com/donutloop/

git clone [email protected]:donutloop/toolkit.git

cd toolkit

go install ./cmd/xcode

Usage

USAGE
  xcode [flags]

FLAGS
  -in     input file
  -out    output file
  -pkg    package name
  -type   type

Example generation

xcode -in $GOPATH/src/github.com/donutloop/toolkit/worker/worker.go -out $GOPATH/src/github.com/donutloop/toolkit/worker/new_worker.go -pkg test -type int32 

Example call for generated code

workerHandler := func(v int32) {
    fmt.Println(v)
}

queue := worker.New(2, workerHandler, 10)

queue <- int32(3)

Contribution

Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!

If you'd like to contribute to toolkit, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple.

Please read and follow our Contributing.

Code of Conduct

Please read and follow our Code of Conduct.

toolkit's People

Contributors

donutloop avatar dvrkps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

toolkit's Issues

Implement a basic promise

Write a good understandable documentation for promise
Implementation business logic of promise
Implementation of testing and benchmark

Implement a event looper (Do one thing once in a while)

Runner executes the provided function in a specific interval

Write a good understandable documentation for event looper
Creation of workflow diagram, to simplify explanation of event looper
Implementation business logic of event looper
Implementation of testing and benchmark

Implement a FIFO work scheduler

  • Write a good understandable documentation for FIFO scheduler
  • Creation of workflow diagram, to simplify explanation of FIFO scheduler
  • Implementation business logic of FIFO scheduler
  • Implementation of testing and benchmark

Implement a runner

Runner executes the provided functions in concurrent and collects any errors they return

  • Write a good understandable documentation for Runner
  • Creation of workflow diagram, to simplify explanation of Runner
  • Implementation business logic of Runner
  • Implementation of testing and benchmark

Marco response

It might be good to create Marco (response and request)

Ref: https://laravel.com/docs/7.x/responses#response-macros


<?php

namespace App\Providers;

use Illuminate\Support\Facades\Response;
use Illuminate\Support\ServiceProvider;

class ResponseMacroServiceProvider extends ServiceProvider
{
    /**
     * Register the application's response macros.
     *
     * @return void
     */
    public function boot()
    {
        Response::macro('caps', function ($value) {
            return Response::make(strtoupper($value));
        });
    }
}

Implementation of singleton pattern

the singleton pattern is a software design pattern that restricts the instantiation of a type to one object.

Write a good understandable documentation for singleton
Implementation business logic of singleton
Implementation of testing and benchmark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.