Skip to content

Commit

Permalink
feat: add pgx extension
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconi committed Jun 28, 2024
1 parent 9e594e7 commit 559f303
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pgxx/pgxx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package pgxx

func LikeBegins(s string) string {
return s + "%"
}

func LikeEnds(s string) string {
return "%" + s
}

func LikeContains(s string) string {
return LikeBegins(LikeEnds(s))
}
13 changes: 13 additions & 0 deletions pgxx/pgxx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package pgxx

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestLikeContains(t *testing.T) {
assert.Equal(t, LikeBegins("abc"), "abc%")
assert.Equal(t, LikeEnds("abc"), "%abc")
assert.Equal(t, LikeContains("abc"), "%abc%")
}

0 comments on commit 559f303

Please sign in to comment.