Skip to content

Commit c702446

Browse files
authored
Merge branch 'master' into dependabot/go_modules/v3/go.uber.org/zap-1.24.0
2 parents 830bfe7 + 09c8a50 commit c702446

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1059
-434
lines changed

.github/workflows/cb.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
go-version: [ '1.18' ]
13+
go-version: ["1.22"]
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Setup Go ${{ matrix.go-version }}
17-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@v5
1818
with:
1919
go-version: ${{ matrix.go-version }}
2020
- name: Run benchmark
2121
run: make benchmark | tee output.txt
2222
- name: Download previous benchmark data
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
2525
path: ./cache
2626
key: ${{ runner.os }}-benchmark
2727
- name: Store benchmark result
2828
uses: benchmark-action/github-action-benchmark@v1
2929
with:
30-
tool: 'go'
30+
tool: "go"
3131
output-file-path: output.txt
3232
external-data-json-path: ./cache/benchmark-data.json
3333
fail-on-alert: true
3434
github-token: ${{ secrets.GITHUB_TOKEN }}
3535
comment-always: true
3636
comment-on-alert: true
37-
alert-comment-cc-users: '@fr33r'
37+
alert-comment-cc-users: "@fr33r"

.github/workflows/ci.yaml

+20-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,30 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19' ]
10+
go-version:
11+
[
12+
"1.13",
13+
"1.14",
14+
"1.15",
15+
"1.16",
16+
"1.17",
17+
"1.18",
18+
"1.19",
19+
"1.20",
20+
"1.21",
21+
"1.22",
22+
]
1123
steps:
12-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
1325
- name: Setup Go ${{ matrix.go-version }}
14-
uses: actions/setup-go@v3
26+
uses: actions/setup-go@v5
1527
with:
1628
go-version: ${{ matrix.go-version }}
1729
- name: Display Go version
1830
run: go version
1931
- name: Run Unit Tests
2032
run: make tests-v3
21-
- uses: codecov/codecov-action@v3
33+
- uses: codecov/codecov-action@v4
2234
name: Upload Code Coverage
2335
with:
2436
token: ${{ secrets.CODECOV_TOKEN }}
@@ -30,18 +42,18 @@ jobs:
3042
runs-on: ubuntu-latest
3143
strategy:
3244
matrix:
33-
go-version: [ '1.18', '1.19' ]
45+
go-version: ["1.21", "1.22", "1.23"]
3446
steps:
35-
- uses: actions/checkout@v3
47+
- uses: actions/checkout@v4
3648
- name: Setup Go ${{ matrix.go-version }}
37-
uses: actions/setup-go@v3
49+
uses: actions/setup-go@v5
3850
with:
3951
go-version: ${{ matrix.go-version }}
4052
- name: Display Go version
4153
run: go version
4254
- name: Run Unit Tests
4355
run: make tests-v4
44-
- uses: codecov/codecov-action@v3
56+
- uses: codecov/codecov-action@v4
4557
name: Upload Code Coverage
4658
with:
4759
token: ${{ secrets.CODECOV_TOKEN }}

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ mocks-v3:
3838
mocks-v4:
3939
@echo making v4 mocks...
4040
@mockgen -source=v4/unit_data_mapper.go -destination=v4/internal/mock/unit_data_mapper.go -package=mock -mock_names=UnitDataMapper=UnitDataMapper
41+
@mockgen -source=v4/unit_cache.go -destination=v4/internal/mock/unit_cache.go -package=mock -mock_names=UnitCacheClient=UnitCacheClient
4142
@echo done!
4243

4344
mocks: mocks-v3 mocks-v4

README.md

+11-88
Original file line numberDiff line numberDiff line change
@@ -38,91 +38,21 @@ For SQL datastores, also enjoy:
3838
- transaction only remains open as long as it takes for the unit to be saved.
3939
- proper threading of `context.Context` with `database/sql`.
4040

41-
## Release information
42-
43-
| Version | Supported | Documentation |
44-
|---------|-----------|-------------------------------|
45-
| `V4` || [See][v4-docs] `v4/README.md` |
46-
| `V3` || None |
47-
| `V2` || None |
48-
| `V1` || None |
49-
50-
### V4
51-
52-
#### [4.0.0-beta.5][v4.0.0-beta.5]
53-
54-
- Introduce `unit.InsertFunc`, `unit.UpdateFunc`, and `unit.DeleteFunc` options.
55-
- Refactored internals to to use `unit.DataMapperFunc` instead of `unit.DataMapper`.
56-
- Removed `DataMappers` property from `unit.Options`.
57-
- Renamed `work.DataMapper` to `work.UnitDataMapper` for consistency.
58-
59-
#### [4.0.0-beta.4][v4.0.0-beta.4]
60-
61-
- Introduces the work unit cache.
62-
- Each time the `Register` method is called, the provided entities will be placed in a cache if deemed eligible (have implemented the `identifierer` or `ider` interfaces).
63-
- Entities will be removed from the cache if specified to `Alter` or `Remove`.
64-
65-
#### [4.0.0-beta.3][v4.0.0-beta.3]
66-
67-
- Various dependency upgrades to address vulnerability [alerts][dependabot-alerts].
68-
- Upgraded `github.com/uber-go/tally` dependency to version `v3.4.2`.
69-
- Upgraded `github.com/stretchr/testify` dependency to version `v1.8.0`.
70-
- Upgraded `go.uber.org/zap` dependency to version `v1.21.1`.
71-
72-
#### [4.0.0-beta.2][v4.0.0-beta.2]
73-
74-
- Introduce initial round of benchmarks.
75-
- Introduce support for 4 more additional metrics.
76-
- `unit.retry.attempt`
77-
- `unit.insert`
78-
- `unit.update`
79-
- `unit.delete`
80-
- Improve documentation & switch to pkg.go.dev.
81-
- Introduce metric demo.
82-
- `make demo`
41+
## Getting Started
8342

84-
#### [4.0.0-beta][v4.0.0-beta]
43+
Ready to get moving? Head over to the [Getting Started][getting-started] page in the wiki.
8544

86-
- Introduce `unit` package for aliasing.
87-
- Reduces API footprint.
88-
- Often "flows" better.
89-
- Introduce retries and related configuration.
90-
- Reconsolidate data mappers abstractions into single `DataMapper` interface.
91-
- Introduce `MapperContext`.
92-
- Alter `Save` to be `context.Context` aware.
93-
- Refactor `work.NewUnit` to dynamically choose which type of work unit to
94-
create based on provided options.
95-
- Reconsolidate uniter functionality.
96-
97-
### V3
98-
99-
#### [3.2.1][v3.2.1]
100-
101-
- Various dependency upgrades to address vulnerability [alerts][dependabot-alerts].
102-
- Upgraded `github.com/uber-go/tally` dependency to version `v3.4.2`.
103-
- Upgraded `github.com/stretchr/testify` dependency to version `v1.8.0`.
104-
- Upgraded `go.uber.org/zap` dependency to version `v1.21.1`.
105-
106-
#### [3.2.0][v3.2.0]
107-
108-
- Introduce [lifecycle actions][actions-pr].
109-
- Introduce [concurrency support][concurrency-pr].
110-
111-
#### [3.0.0][v3.0.0]
112-
113-
- Introduce support for Go modules.
114-
115-
### V2
116-
117-
- NO LONGER SUPPORTED. CODE REMOVED. SEE `v2.x.x` [TAGS][tags].
118-
119-
### V1
45+
## Release information
12046

121-
- NO LONGER SUPPORTED. CODE REMOVED. SEE `v1.x.x` [TAGS][tags].
47+
| Version | Supported |
48+
|---------|-----------|
49+
| `V4` ||
50+
| `V3` ||
51+
| `V2` ||
52+
| `V1` ||
12253

12354
> Versions `1.x.x` and `2.x.x` are no longer supported. Please upgrade to
124-
`3.x.x+` to receive the latest and greatest features, such as
125-
[lifecycle actions][actions-pr] and [concurrency support][concurrency-pr]!
55+
at least `3.x.x+` to receive the latest and greatest features!
12656

12757
## Dependancy Information
12858

@@ -169,13 +99,6 @@ how we do things.
16999
[blog]: https://medium.com/@freerjm/work-units-ec2da48cf574
170100
[blog-img]: https://img.shields.io/badge/blog-medium-lightgrey
171101
[v4-docs]: https://github.com/freerware/work/blob/master/v4/README.md
172-
[v3.2.0]: https://github.com/freerware/work/releases/tag/v3.2.0
173-
[v3.2.1]: https://github.com/freerware/work/releases/tag/v3.2.1
174-
[v3.0.0]: https://github.com/freerware/work/releases/tag/v3.0.0
175-
[v4.0.0-beta]: https://github.com/freerware/work/releases/tag/v4.0.0-beta
176-
[v4.0.0-beta.2]: https://github.com/freerware/work/releases/tag/v4.0.0-beta.2
177-
[v4.0.0-beta.3]: https://github.com/freerware/work/releases/tag/v4.0.0-beta.3
178-
[v4.0.0-beta.4]: https://github.com/freerware/work/releases/tag/v4.0.0-beta.4
179-
[v4.0.0-beta.5]: https://github.com/freerware/work/releases/tag/v4.0.0-beta.5
180102
[tags]: https://github.com/freerware/work/tags
181103
[dependabot-alerts]: https://github.com/freerware/work/security/dependabot?q=is%3Aclosed
104+
[getting-started]: https://github.com/freerware/work/wiki/Getting-Started

v3/best_effort_unit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/best_effort_unit_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/best_effort_uniter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/best_effort_uniter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/data_mapper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/freerware/work/v3
33
go 1.13
44

55
require (
6-
github.com/DATA-DOG/go-sqlmock v1.5.0
6+
github.com/DATA-DOG/go-sqlmock v1.5.2
77
github.com/golang/mock v1.6.0
88
github.com/stretchr/testify v1.8.2
99
github.com/twmb/murmur3 v1.1.6 // indirect

v3/go.sum

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
2-
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
1+
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
2+
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
33
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
44
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
55
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
66
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
77
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
88
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
99
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
10+
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46/go.mod h1:yyMNCyc/Ib3bDTKd379tNMpB/7/H5TjM2Y9QJ5THLbE=
1011
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
1112
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
1213
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=

v3/sql_data_mapper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/sql_unit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/sql_unit_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/sql_uniter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/sql_uniter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/type_name.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/unit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/unit_action.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/unit_action_context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/unit_options.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/unit_options_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/uniter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

v3/work_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2022 Freerware
1+
/* Copyright 2025 Freerware
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)