Golang library for MongoDB (DBAL)

Here is my DBAL implementation for mongoDB that I am using in my daily routines.

It contains features that I am using frequently it does not contain any implementation for DSL or Query Builders.

All extra features will be added later or maybe I will put it into a different library.

https://github.com/wajox/mongol

CloneGoPkg – CLI tool to create new package from template in git repository

CloneGoPkg is a simple CLI tool to create your own package from template based on any git repository

Install

go install -i github.com/wajox/clonegopkg

Usage

# clonegopkg clone [git_repository_template] [new_pkg]
clonegopkg clone git@github.com:wajox/gobase.git github.com/wajox/newproject

Sources

GitHub – https://github.com/wajox/clonegopkg

Watermill Pub-Sub(broadcasting) example for AMQP(rabbit)

What is Watermill?

“Watermill is a Golang library for working efficiently with message streams. It is intended for building event-driven applications. It can be used for event sourcing, RPC over messages, sagas, and whatever else comes to your mind. You can use conventional pub/sub implementations like Kafka or RabbitMQ, but also HTTP or MySQL binlog, if that fits your use case. It comes with a set of Pub/Sub implementations and can be easily extended by your own. Watermill also ships with standard middlewares like instrumentation, poison queue, throttling, correlation, and other tools used by every message-driven application.”

Why use Watermill?

“With more projects adopting the microservices pattern over recent years, we realized that synchronous communication is not always the right choice. Asynchronous methods started to grow as a new standard way to communicate. But while there’s a lot of existing tooling for synchronous integration patterns (e.g. HTTP), correctly setting up a message-oriented project can be a challenge. There’s a lot of different message queues and streaming systems, each with different features and client library API. Watermill aims to be the standard messaging library for Go, hiding all that complexity behind an API that is easy to understand. It provides all you might need for building an application based on events or other asynchronous patterns. After looking at the examples, you should be able to quickly integrate Watermill with your project.”


Golang Application Template

Here is my template for Golang Application – https://github.com/ildarusmanov/gobase https://github.com/wajox/gobase

Only one thing that you have to do after git clone – replace all package name entries, from github.com/ildarusmanov/gobase github.com/wajox/gobase to [your_package_name]

UPD:

Template has been updated and moved into wajox/gobase repository.

IT Nights — ночная конференция в Иннополисе

Приглашаю всех на ИТ конференцию в г.Иннополис 🙂

АНОНС МЕРОПРИЯТИЯ:

1–3 АВГУСТА 
ИННОПОЛИС, РЕСПУБЛИКА ТАТАРСТАН

IT Nights – Первая ночная конференция 
для ИТ-специалистов. 
Потому что ночью происходит 
всё самое интересное. 

https://it-nights.ru

ПОДРОБНЕЕ О ГОРОДЕ:

Иннопо́лис — город в Верхнеуслонском районе Республики Татарстан, город-спутник Казани, входящий в её агломерацию. В поселении расположены Университет Иннополис и особая экономическая зона «Иннополис». 

http://www.innopolis.com

From Rails to KrakenD proxy: config generation for your routes

require "action_dispatch/routing/inspector"

begin
  namespace :krakend do
    task :routes => :environment do

      inspector = ActionDispatch::Routing::RoutesInspector.new(Rails.application.routes.routes)
      formatter = CustomRoutesFormatter.new
      routes_filter = {}

      puts inspector.format(formatter, routes_filter)
    end
  end
end

class CustomRoutesFormatter < ActionDispatch::Routing::ConsoleFormatter::Expanded
  def section_title(title)
  end

  def section(routes)
    @buffer << draw_expanded_section(routes)
  end

  private

  def draw_expanded_section(routes)
    routes.map.each_with_index do |r, i|
      path = r[:path].gsub("(.:format)", "").gsub(/:([a-z_]*)/, "{\\1}")

      <<~MESSAGE.chomp
        {
          "endpoint": "#{path}",
          "method": "#{r[:verb]}",
          "querystring_params": ["*"],
          "extra_config": {},
          "output_encoding": "no-op",
          "concurrent_calls": 1,
          "headers_to_pass": ["*"],
          "backend": [
            {
              "url_pattern": "#{path}",
              "encoding": "no-op",
              "extra_config": {},
              "sd": "static",
              "host": [
                "http://rails-app"
              ],
              "disable_host_sanitize": true
            }
          ]
        },
      MESSAGE
    end
  end
end

This approach can help you easily build krakend.json for your rails application.