Skip to content

Commit

Permalink
Add support for pgxpool
Browse files Browse the repository at this point in the history
This commit adds a struct for managing transaction. WithTransaction
and RetryTransaction functions are deprecated in favour of Transaction
struct. Retry function is also deprecated in favour of the
github.com/arsham/retry library.
  • Loading branch information
arsham committed Aug 16, 2020
1 parent cd2b6e4 commit e5a0793
Show file tree
Hide file tree
Showing 21 changed files with 2,827 additions and 164 deletions.
67 changes: 67 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# CHANGELOG

{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups }}
### {{ .Title }}
{{ range .Commits -}}
{{ if not (contains .Subject "<code>") -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ if .Subject }}{{ .Subject }}{{ else }}{{ .Header }}{{ end }}
{{ end -}}
{{ end -}}
{{ end }}
{{ else }}
{{ range .Unreleased.Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ if .Subject }}{{ .Subject }}{{ else }}{{ .Header }}{{ end }}
{{ end }}
{{ end -}}

{{- if .Unreleased.NoteGroups -}}
{{ range .Unreleased.NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ if .CommitGroups -}}
{{ range .CommitGroups }}
### {{ .Title }}
{{ range .Commits -}}
{{ if not (contains .Subject "<code>") -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ if .Subject }}{{ .Subject }}{{ else }}{{ .Header }}{{ end }}
{{ end -}}
{{ end -}}
{{ end }}
{{ else }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ if .Subject }}{{ .Subject }}{{ else }}{{ .Header }}{{ end }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}

[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
75 changes: 75 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/arsham/dbtools

options:
commits:
# filters:
# Type:
# - feat
# - add
# - return
# - feature
# - fix
# - perf
# - refactor

commit_groups:
# group_by: Type

title_maps:
feat: Added
Feat: Added
add: Added
Add: Added
feature: New Feature
Feature: New Feature
fix: Fixed
Fix: Fixed
merge: Merged
Merge: Merged
perf: Performance Improvements
Perf: Performance Improvements
refactor: Code Refactoring
Refactor: Code Refactoring
Increase: Code Refactoring

header:
# { header }
# {type}{scope} { subject }
# add(core): new feature to the thing (closes #666)
# We are ignoring paranteses around the scope.
pattern: "^((\\w+)(\\((\\w+)\\))?:?\\s(.+))$"
pattern_maps:
- Subject
- Type
-
- Scope

issues:
prefix:
- #

refs:
actions:
- Closes
- Fixes
- Refs

merges:
pattern: "^Merge branch '(\\w+)'$"
pattern_maps:
- Source

reverts:
pattern: "^Revert \"([\\s\\S]*)\"$"
pattern_maps:
- Header

notes:
keywords:
- BREAKING CHANGE
- IMPORTANT
- important
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
vendor/
tmp/
99 changes: 99 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
linters-settings:
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
golint:
min-confidence: 0
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
goconst:
min-len: 2
min-occurrences: 2
misspell:
locale: UK
lll:
line-length: 140
goimports:
local-prefixes: github.com/golangci/golangci-lint
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- wrapperFunc
- dupImport # https://github.com/go-critic/go-critic/issues/845
funlen:
lines: 100
statements: 50


issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gosec # security check is not impoerant in tests
- dupl # we usualy duplicate code in tests

run:
skip-dirs:
- model
- tmp
- bin
- scripts

tests: true
build-tags:
- integration

linters:
disable-all: true
fast: true
enable:
- asciicheck
- bodyclose
- dogsled
- depguard
- dupl
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- golint
- goprintffuncname
- gosec
- gosimple
- interfacer
- maligned
- misspell
- nakedret
- nestif
- prealloc
- rowserrcheck
- scopelint
- staticcheck
- stylecheck
- unconvert
- unparam
- unused
- whitespace

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.30.x
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
23 changes: 18 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: go
dist: xenial

dist: focal

os:
- linux
Expand All @@ -8,12 +9,24 @@ env:
- GO111MODULE=on

go:
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x
- 1.15.x
- tip

matrix:
allow_failures:
- go: tip

before_install:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0

script:
- go test -failfast -v -coverprofile=coverage.txt -covermode=atomic ./...
- make ci_tests

after_success:
- bash <(curl -s https://codecov.io/bash)

cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# CHANGELOG

<a name="unreleased"></a>
## [Unreleased]



<a name="v0.4.0"></a>
## [v0.4.0] - 2020-08-16

### Added
- Add support for pgxpool


<a name="v0.3.2"></a>
## [v0.3.2] - 2019-10-16

### Handle
- Handle function panics


<a name="v0.3.1"></a>
## [v0.3.1] - 2019-07-17

### Update
- Update badges


<a name="v0.3.0"></a>
## [v0.3.0] - 2019-07-17

### Added
- Add db helpers and rename the repo to dbtools


<a name="v0.2.0"></a>
## [v0.2.0] - 2019-07-16

### Added
- Add mocha report and update README.md file


<a name="v0.1.0"></a>
## v0.1.0 - 2019-07-02

### Added
- Add ValueRecorder and OkValue

### Initial
- Initial commit



[Unreleased]: https://github.com/arsham/dbtools/compare/v0.4.0...HEAD
[v0.4.0]: https://github.com/arsham/dbtools/compare/v0.3.2...v0.4.0
[v0.3.2]: https://github.com/arsham/dbtools/compare/v0.3.1...v0.3.2
[v0.3.1]: https://github.com/arsham/dbtools/compare/v0.3.0...v0.3.1
[v0.3.0]: https://github.com/arsham/dbtools/compare/v0.2.0...v0.3.0
[v0.2.0]: https://github.com/arsham/dbtools/compare/v0.1.0...v0.2.0
Loading

0 comments on commit e5a0793

Please sign in to comment.