common

command module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 0 Imported by: 0

README

Common Library

Go Report Card shields shields shields

Introduction

Generic functions that would be handy while building your Golang utility.

This library stands on the shoulders of various libraries built by some awesome folks.

Installation

Get the latest version of GoCD sdk using go get command.

go get github.com/nikhilsbhat/common@latest

Get specific version of the same.

go get github.com/nikhilsbhat/common@v0.0.2

Usage

package main

import (
	"github.com/nikhilsbhat/common/renderer"
	"github.com/sirupsen/logrus"
	"log"
	"os"
)

type Object struct {
	Name string
	Date string
}

func main() {
	newObject := []Object{
		{Name: "nikhil", Date: "01-01-2024"},
		{Name: "john", Date: "01-02-2024"},
	}

	logger := logrus.New()
	render := renderer.GetRenderer(os.Stdout, logger, true, true, false, false, false)

	if err := render.Render(newObject); err != nil {
		log.Fatal(err)
	}
}

Above code should generate yaml as below:

---
- Date: 01-01-2024
  Name: nikhil
- Date: 01-02-2024
  Name: john

More example of the libraries can be found here.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
nolint:typecheck
nolint:typecheck

Jump to

Keyboard shortcuts

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