package module
Version: v1.4.0 Latest Latest

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

Go to latest
Published: Jun 26, 2020 License: GPL-3.0 Imports: 9 Imported by: 0



Application wrapper library

Wrapper is a golang library to wrap objects into one bigger structure and handle dynamic openning on usage.


Create a raw wrapper object

package main

import "gitlab.com/redpanda-utils/wrapper"

func main() {
	w := wrapper.NewWrapper()

This object does not have any subojects. You can customize your wrapper by issuing the proper methods.

Firebase App

Add firebase app:

package main

import "gitlab.com/redpanda-utils/wrapper"

func main() {
	w := wrapper.NewWrapper()

	/* Add firebase app */

	/* Use the method FirebaseApp() to obtain the firebase app */

Grpc Server

Add grpc server:

package main

import "gitlab.com/redpanda-utils/wrapper"

func main() {
	w := wrapper.NewWrapper()

	/* Add grpc server */
	w.OpenGrpcServer("", "5012")
	/* For a TLS grpc server use this function */
	/* w.OpenGrpcTLSServer("", "5012", "cert.pem", "key.pem") */

	/* Use the method GrpcServer() to obtain the grpc server and set the proper
		endpoints */

	/* Serve */

Postgresql Connection

Add postgresql connection:

package main

import "gitlab.com/redpanda-utils/wrapper"

func main() {
	w := wrapper.NewWrapper()

	/* Add psql connection */
	w.OpenPsqlConn(host, port, database_name, schema, user, password)

	/* Use the method PsqlConn() to obtain postgresql connection */

	/* Close */




This section is empty.


This section is empty.


This section is empty.


type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields

Wrapper type

func NewWrapper

func NewWrapper() *Wrapper

Creates a new wrapper

func (*Wrapper) CloseKafkaConn added in v1.4.0

func (wrapper *Wrapper) CloseKafkaConn()

Closes kafka connection

func (*Wrapper) ClosePsqlConn

func (wrapper *Wrapper) ClosePsqlConn()

Closes psql server

func (*Wrapper) FirebaseApp added in v1.2.0

func (wrapper *Wrapper) FirebaseApp() (*firebase.App, error)

Returns firebase app

func (*Wrapper) GrpcServer

func (wrapper *Wrapper) GrpcServer() (*grpc.Server, error)

Returns grpc server

func (*Wrapper) KafkaConnConsumer added in v1.4.0

func (wrapper *Wrapper) KafkaConnConsumer() (*kafka.Consumer, error)

Returns kafka connection consumer

func (*Wrapper) KafkaConnProducer added in v1.4.0

func (wrapper *Wrapper) KafkaConnProducer() (*kafka.Producer, error)

Returns kafka connection producer

func (*Wrapper) OpenFirebaseApp added in v1.2.0

func (wrapper *Wrapper) OpenFirebaseApp() error

Opens firebase app

func (*Wrapper) OpenGrpcServer

func (wrapper *Wrapper) OpenGrpcServer(ifc, port string) error

Opens grpc server

func (*Wrapper) OpenGrpcTLSServer added in v1.3.1

func (wrapper *Wrapper) OpenGrpcTLSServer(ifc, port, cert, key string) error

Opens grpc TLS server

func (*Wrapper) OpenKafkaConn added in v1.4.0

func (wrapper *Wrapper) OpenKafkaConn() error

Opens kafka connection both consumer and producer

func (*Wrapper) OpenKafkaConnConsumer added in v1.4.0

func (wrapper *Wrapper) OpenKafkaConnConsumer(server, groupId,
	autoOffsetReset string) error

Opens kafka connection consumer

func (*Wrapper) OpenKafkaConnProducer added in v1.4.0

func (wrapper *Wrapper) OpenKafkaConnProducer() error

Opens kafka connection producer

func (*Wrapper) OpenPsqlConn

func (wrapper *Wrapper) OpenPsqlConn(host, port, name, schema, user,
	password string) error

Opens psql server

func (*Wrapper) PsqlConn

func (wrapper *Wrapper) PsqlConn() (*gorm.DB, error)

Returns psql connection

func (*Wrapper) ServeGrpcServer

func (wrapper *Wrapper) ServeGrpcServer() error

Serves grpc server

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL