-
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.
feat: Add support for members in rotas (#49)
This PR adds the functionality to add/update members. Demo: https://www.loom.com/share/448df316fcdd4d6abe8751c7f3f85d96?sid=713fd50a-bdb3-489a-a3c8-d4cb56b70c61
- Loading branch information
1 parent
35956f9
commit 50d4a2a
Showing
22 changed files
with
752 additions
and
62 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
DROP TABLE MEMBERS; | ||
DROP TABLE ROTAS; |
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
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,13 @@ | ||
package internal | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestDb(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Internal Suite") | ||
} |
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,16 @@ | ||
package internal | ||
|
||
func Unique[T comparable](slice []T) []T { | ||
// create a map with all the values as key | ||
uniqMap := make(map[T]struct{}) | ||
for _, v := range slice { | ||
uniqMap[v] = struct{}{} | ||
} | ||
|
||
// turn the map keys into a slice | ||
uniqSlice := make([]T, 0, len(uniqMap)) | ||
for v := range uniqMap { | ||
uniqSlice = append(uniqSlice, v) | ||
} | ||
return uniqSlice | ||
} |
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,43 @@ | ||
package internal | ||
|
||
import ( | ||
"sort" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Unique", func() { | ||
It("should return unique strings", func() { | ||
arr := []string{ | ||
"mice", | ||
"mice", | ||
"mice", | ||
"mice", | ||
"mice", | ||
"mice", | ||
"mice", | ||
"toad", | ||
"toad", | ||
"mice", | ||
} | ||
result := Unique(arr) | ||
sort.Strings(result) | ||
Expect(result).To(Equal([]string{"mice", "toad"})) | ||
}) | ||
|
||
It("should return unique numbers", func() { | ||
arr := []int{ | ||
1, | ||
1, | ||
2, | ||
3, | ||
1, | ||
2, | ||
3, | ||
} | ||
result := Unique(arr) | ||
sort.Ints(result) | ||
Expect(result).To(Equal([]int{1, 2, 3})) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.