Socket
Socket
Sign inDemoInstall

github.com/aldelo/common

Package Overview
Dependencies
91
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/aldelo/common

Package helper: common project provides commonly used helper utility functions, custom utility types, and third party package wrappers. common project helps code reuse, and faster composition of logic without having to delve into commonly recurring code logic and related testings. common project source directories and brief description: + /ascii = helper types and/or functions related to ascii manipulations. + /crypto = helper types and/or functions related to encryption, decryption, hashing, such as rsa, aes, sha, tls etc. + /csv = helper types and/or functions related to csv file manipulations. + /rest = helper types and/or functions related to http rest api GET, POST, PUT, DELETE actions invoked from client side. + /tcp = helper types providing wrapped tcp client and tcp server logic. - /wrapper = wrappers provides a simpler usage path to third party packages, as well as adding additional enhancements. /helper-conv.go = helpers for data conversion operations. /helper-db.go = helpers for database data type operations. /helper-emv.go = helpers for emv chip card related operations. /helper-io.go = helpers for io related operations. /helper-net.go = helpers for network related operations. /helper-num.go = helpers for numeric related operations. /helper-other.go = helpers for misc. uncategorized operations. /helper-reflect.go = helpers for reflection based operations. /helper-regex.go = helpers for regular express related operations. /helper-str.go = helpers for string operations. /helper-struct.go = helpers for struct related operations. /helper-time.go = helpers for time related operations. /helper-uuid.go = helpers for generating globally unique ids.


Version published

Readme

Source

common

Common helper utilities and wrappers for code reuse.

When we code projects, we constantly encounter a similar set of functionality and logic. This package's intent is to wrap those commonly recurring functionalities and access points into a reusable helper package, so that we don't have to keep maintaining separate code bases.

This package will continue to be updated with more reusable code as well.

Usage

  • To use the common package:
    • in the project folder root:
    • go mod init
    • go mod tidy
  • For example, if project is "HelloWorld":
    • /HelloWorld/go mod init
    • /HelloWorld/go mod tidy

types of helpers

  • string helpers
  • number helpers
  • io helpers
  • converter helpers
  • db type helpers
  • net helpers
  • reflection helpers
  • regex helpers
  • time and date helpers
  • uuid helpers
  • crypto helpers (aes, gcm, rsa, sha, etc)
  • csv parser helpers
  • wrappers for aws related services
    • service discovery / cloud map wrapper (using aws sdk)
    • dynamodb / dax wrapper (using aws sdk)
    • kms wrapper (using aws sdk)
    • redis wrapper (using go-redis package)
    • s3 wrapper (using aws sdk)
    • ses wrapper (using aws sdk)
    • sqs wrapper (using aws sdk)
    • sns wrapper (using aws sdk)
    • gin web server
    • xray wrapper (using aws sdk)
      • use xray.Init() to config
      • use xray.SetXRayServiceOn() to enable xray tracing
      • xray tracing is already coded into the following services:
        • kms, cloudmap, dynamodb, redis, s3, ses, sns, sqs, mysql, gin
  • wrappers for relational database access
    • mysql wrapper (using sqlx package)
    • sqlite wrapper (using sqlx package)
    • sqlserver wrapper (using sqlx package)
  • other wrappers
    • for running as systemd service
    • for logging and config
    • for circuit breaker and rate limit
    • etc.

build and deploy automation

  • Create a file such as 'build.sh' within project
  • Edit file content as:
    #!/bin/zsh

    GOOS=linux GOARCH=amd64 go build
    scp -i ~/.ssh/YourKey.pem YourBinary hostUserName@hostIP:/home/hostUserName/targetFolder
  • Descriptions:
    • YourKey.pem = the Linux Host SSH Certificate Key
    • YourBinary = the Binary Build by go build to Upload
    • hostUserName = the Linux Host Login Username
    • hostIP = the Linux Host IP Address
    • hostUserName = the Linux Host Login Username
    • targetFolder = the Linux Host Folder Where SCP Will Upload YourBinary To

FAQs

Last updated on 10 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc