-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
196df59
commit 7183685
Showing
8 changed files
with
499 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: golangci-lint | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
strategy: | ||
matrix: | ||
go: [stable] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
name: lint | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
issues: | ||
exclude-rules: | ||
# disable funlen for all _test.go files | ||
- path: _test.go | ||
linters: | ||
- funlen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
[![Go](https://github.com/manuelarte/GoTime/actions/workflows/go.yml/badge.svg)](https://github.com/manuelarte/GoTime/actions/workflows/go.yml) | ||
![coverage](https://raw.githubusercontent.com/manuelarte/GoTime/badges/.badges/main/coverage.svg) | ||
# GoTime | ||
# 🕐 GoTime 🕐 | ||
|
||
## Introduction | ||
## 📝 How to install it | ||
|
||
> go get github.com/manuelarte/GoTime | ||
## ✏️ Introduction | ||
|
||
GoTime contains the following utility struct | ||
|
||
### TimePeriod | ||
|
||
Construct a time period based on start time and end time. | ||
|
||
> timePeriod, err := NewTimePeriod(startTime, endTime) | ||
> tp, err := NewTimePeriod(startTime, endTime) | ||
The time period is built based on the overlapping period between the two dates. | ||
|
||
``` | ||
t1 ____|________ | ||
t2 _________| | ||
tp ____|‾‾‾‾|___ | ||
``` | ||
|
||
It also provides a function `Overlaps` to check whether the two time periods overlaps, and what's the overlapping period | ||
|
||
e.g. | ||
|
||
``` | ||
tp1 ____|‾‾‾‾‾‾‾‾‾‾‾‾‾‾ | ||
tp2 _________|‾‾‾‾‾‾|__ | ||
tp ____|‾‾‾‾|_________ | ||
``` | ||
|
||
For more information check the [examples](./examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
module GoTime | ||
|
||
go 1.22 | ||
|
||
require github.com/stretchr/testify v1.9.0 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.