github.com/aldelo/common@v1.5.1/README.md (about) 1 # common 2 Common helper utilities and wrappers for code reuse. 3 4 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. 5 6 This package will continue to be updated with more reusable code as well. 7 8 # Usage 9 - To use the common package: 10 - in the project folder root: 11 - go mod init 12 - go mod tidy 13 - For example, if project is "HelloWorld": 14 - /HelloWorld/go mod init 15 - /HelloWorld/go mod tidy 16 17 # types of helpers 18 - string helpers 19 - number helpers 20 - io helpers 21 - converter helpers 22 - db type helpers 23 - net helpers 24 - reflection helpers 25 - regex helpers 26 - time and date helpers 27 - uuid helpers 28 - crypto helpers (aes, gcm, rsa, sha, etc) 29 - csv parser helpers 30 - wrappers for aws related services 31 - service discovery / cloud map wrapper (using aws sdk) 32 - dynamodb / dax wrapper (using aws sdk) 33 - kms wrapper (using aws sdk) 34 - redis wrapper (using go-redis package) 35 - s3 wrapper (using aws sdk) 36 - ses wrapper (using aws sdk) 37 - sqs wrapper (using aws sdk) 38 - sns wrapper (using aws sdk) 39 - gin web server 40 - xray wrapper (using aws sdk) 41 - use xray.Init() to config 42 - use xray.SetXRayServiceOn() to enable xray tracing 43 - xray tracing is already coded into the following services: 44 - kms, cloudmap, dynamodb, redis, s3, ses, sns, sqs, mysql, gin 45 - wrappers for relational database access 46 - mysql wrapper (using sqlx package) 47 - sqlite wrapper (using sqlx package) 48 - sqlserver wrapper (using sqlx package) 49 - other wrappers 50 - for running as systemd service 51 - for logging and config 52 - for circuit breaker and rate limit 53 - etc. 54 55 # build and deploy automation 56 - Create a file such as 'build.sh' within project 57 - Edit file content as: 58 ``` 59 #!/bin/zsh 60 61 GOOS=linux GOARCH=amd64 go build 62 scp -i ~/.ssh/YourKey.pem YourBinary hostUserName@hostIP:/home/hostUserName/targetFolder 63 ``` 64 - Descriptions: 65 - YourKey.pem = the Linux Host SSH Certificate Key 66 - YourBinary = the Binary Build by go build to Upload 67 - hostUserName = the Linux Host Login Username 68 - hostIP = the Linux Host IP Address 69 - hostUserName = the Linux Host Login Username 70 - targetFolder = the Linux Host Folder Where SCP Will Upload YourBinary To 71