Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: database variable #316

Merged
merged 22 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
da009fd
Upgrade v1.13.1 (#295)
hwbrzzl Sep 10, 2023
9cf5e08
Update README
hwbrzzl Sep 10, 2023
29d822a
build(deps): bump the go-modules group with 1 update (#296)
dependabot[bot] Sep 12, 2023
db2fcd6
build(deps): bump the go-modules group with 1 update (#297)
dependabot[bot] Sep 13, 2023
9a04471
build(deps): bump the go-modules group with 1 update (#299)
dependabot[bot] Sep 15, 2023
acf84af
build(deps): bump the github-actions group with 1 update (#300)
dependabot[bot] Sep 15, 2023
144c25f
feat: add GetBytes method and test cases (#298)
devhaozi Sep 17, 2023
834276c
feat: Add interface comments (#292)
kkumar-gcc Sep 18, 2023
e35e809
build(deps): bump the go-modules group with 1 update (#301)
dependabot[bot] Sep 22, 2023
e6aaa5b
build(deps): bump the go-modules group with 1 update (#303)
dependabot[bot] Sep 23, 2023
431933a
fix:[#263] There is a path error in the filesystem module (#305)
hwbrzzl Sep 27, 2023
95f3d3a
feat: Add Fluent String helpers (#304)
kkumar-gcc Oct 2, 2023
f9d300e
fix: #267 (#306)
devhaozi Oct 3, 2023
72e221e
refactor: move mocks (#307)
devhaozi Oct 5, 2023
4a6e705
build(deps): bump the go-modules group with 1 update (#310)
dependabot[bot] Oct 6, 2023
b1c0268
build(deps): bump the github-actions group with 1 update (#312)
dependabot[bot] Oct 7, 2023
2ecb709
build(deps): bump the go-modules group with 1 update (#313)
dependabot[bot] Oct 7, 2023
1fe58aa
build(deps): bump the go-modules group with 2 updates (#315)
dependabot[bot] Oct 10, 2023
acb2b20
Fix database variable
ahmed3mar Oct 10, 2023
25ea367
Restore
ahmed3mar Oct 12, 2023
c864bba
Merge branch 'v1.13.x' of github.com:goravel/framework into patch-1
ahmed3mar Oct 12, 2023
317cadc
Fix database typo
ahmed3mar Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Install dependencies 📦
- name: Install dependencies
run: go mod tidy
- name: Run tests with coverage
- name: Run tests with coverage
run: go test -v -coverprofile="coverage.out" ./...
- name: Upload coverage report to Codecov 📝
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.out
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/cr.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/filesystem.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/mail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Install dependencies 📦
- name: Install dependencies
run: go mod tidy
- name: Run tests
- name: Run tests
run: go test ./mail/...
19 changes: 19 additions & 0 deletions .github/workflows/mockery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Mockery
on:
pull_request:
jobs:
mockery:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Mockery
run: |
go install github.com/vektra/mockery/[email protected]
- name: Generate Mocks
run: |
~/go/bin/mockery --all --keeptree --dir=contracts
- uses: stefanzweifel/git-auto-commit-action@v5
name: Commit changes
with:
commit_message: "chore: update mocks"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Example [https://github.com/goravel/example](https://github.com/goravel/example)
| [Grpc](https://www.goravel.dev/the-basics/grpc.html) | [Artisan Console](https://www.goravel.dev/digging-deeper/artisan-console.html) | [Task Scheduling](https://www.goravel.dev/digging-deeper/task-scheduling.html) | [Queue](https://www.goravel.dev/digging-deeper/queues.html) |
| [Event](https://www.goravel.dev/digging-deeper/event.html) | [FileStorage](https://www.goravel.dev/digging-deeper/filesystem.html) | [Mail](https://www.goravel.dev/digging-deeper/mail.html) | [Validation](https://www.goravel.dev/the-basics/validation.html) |
| [Mock](https://www.goravel.dev/digging-deeper/mock.html) | [Hash](https://www.goravel.dev/security/hashing.html) | [Crypt](https://www.goravel.dev/security/encryption.html) | [Carbon](https://www.goravel.dev/digging-deeper/helpers.html) |
| [Package Development](https://www.goravel.dev/digging-deeper/package-development.html) | [Testing](/testing/getting-started.html) | | |
| [Package Development](https://www.goravel.dev/digging-deeper/package-development.html) | [Testing](https://www.goravel.dev/testing/getting-started.html) | | |

## Roadmap

Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Laravel!
| [Grpc](https://www.goravel.dev/zh/the-basics/grpc.html) | [Artisan 命令行](https://www.goravel.dev/zh/digging-deeper/artisan-console.html) | [任务调度](https://www.goravel.dev/zh/digging-deeper/task-scheduling.html) | [队列](https://www.goravel.dev/zh/digging-deeper/queues.html) |
| [事件系统](https://www.goravel.dev/zh/digging-deeper/event.html) | [文件存储](https://www.goravel.dev/zh/digging-deeper/filesystem.html) | [邮件](https://www.goravel.dev/zh/digging-deeper/mail.html) | [表单验证](https://www.goravel.dev/zh/the-basics/validation.html) |
| [Mock](https://www.goravel.dev/zh/digging-deeper/mock.html) | [Hash](https://www.goravel.dev/zh/security/hashing.html) | [Crypt](https://www.goravel.dev/zh/security/encryption.html) | [Carbon](https://www.goravel.dev/zh/digging-deeper/helpers.html) |
| [扩展包开发](https://www.goravel.dev/zh/digging-deeper/package-development.html) | [测试](/testing/getting-started.html) | | |
| [扩展包开发](https://www.goravel.dev/zh/digging-deeper/package-development.html) | [测试](https://www.goravel.dev/zh/testing/getting-started.html) | | |

## 路线图

Expand Down
6 changes: 3 additions & 3 deletions auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"gorm.io/gorm/clause"

authcontract "github.com/goravel/framework/contracts/auth"
cachemock "github.com/goravel/framework/contracts/cache/mocks"
configmock "github.com/goravel/framework/contracts/config/mocks"
ormmock "github.com/goravel/framework/contracts/database/orm/mocks"
"github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/database/orm"
cachemock "github.com/goravel/framework/mocks/cache"
configmock "github.com/goravel/framework/mocks/config"
ormmock "github.com/goravel/framework/mocks/database/orm"
"github.com/goravel/framework/support/carbon"
)

Expand Down
4 changes: 2 additions & 2 deletions auth/console/jwt_secret_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/assert"

configmock "github.com/goravel/framework/contracts/config/mocks"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
configmock "github.com/goravel/framework/mocks/config"
consolemocks "github.com/goravel/framework/mocks/console"
"github.com/goravel/framework/support"
"github.com/goravel/framework/support/file"
)
Expand Down
2 changes: 1 addition & 1 deletion auth/console/policy_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package console
import (
"testing"

consolemocks "github.com/goravel/framework/contracts/console/mocks"
consolemocks "github.com/goravel/framework/mocks/console"
"github.com/goravel/framework/support/file"

"github.com/stretchr/testify/assert"
Expand Down
32 changes: 16 additions & 16 deletions cache/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/suite"

"github.com/goravel/framework/contracts/cache"
configmock "github.com/goravel/framework/contracts/config/mocks"
logmock "github.com/goravel/framework/contracts/log/mocks"
configmock "github.com/goravel/framework/mocks/config"
logmock "github.com/goravel/framework/mocks/log"
)

type DriverTestSuite struct {
Expand Down Expand Up @@ -74,7 +74,7 @@ func (s *DriverTestSuite) TestStore() {
type Store struct {
}

//Add Store an item in the cache if the key does not exist.
// Add Store an item in the cache if the key does not exist.
func (r *Store) Add(key string, value any, seconds time.Duration) bool {
return true
}
Expand All @@ -83,47 +83,47 @@ func (r *Store) Decrement(key string, value ...int) (int, error) {
return 1, nil
}

//Forever Store an item in the cache indefinitely.
// Forever Store an item in the cache indefinitely.
func (r *Store) Forever(key string, value any) bool {
return true
}

//Forget Remove an item from the cache.
// Forget Remove an item from the cache.
func (r *Store) Forget(key string) bool {
return true
}

//Flush Remove all items from the cache.
// Flush Remove all items from the cache.
func (r *Store) Flush() bool {
return true
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Store) Get(key string, def ...any) any {
return key
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Store) GetBool(key string, def ...bool) bool {
return false
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Store) GetInt(key string, def ...int) int {
return 1
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Store) GetInt64(key string, def ...int64) int64 {
return 1
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Store) GetString(key string, def ...string) string {
return ""
}

//Has Check an item exists in the cache.
// Has Check an item exists in the cache.
func (r *Store) Has(key string) bool {
return true
}
Expand All @@ -136,22 +136,22 @@ func (r *Store) Lock(key string, second ...time.Duration) cache.Lock {
return nil
}

//Pull Retrieve an item from the cache and delete it.
// Pull Retrieve an item from the cache and delete it.
func (r *Store) Pull(key string, def ...any) any {
return def
}

//Put Store an item in the cache for a given number of seconds.
// Put Store an item in the cache for a given number of seconds.
func (r *Store) Put(key string, value any, seconds time.Duration) error {
return nil
}

//Remember Get an item from the cache, or execute the given Closure and store the result.
// Remember Get an item from the cache, or execute the given Closure and store the result.
func (r *Store) Remember(key string, ttl time.Duration, callback func() (any, error)) (any, error) {
return "", nil
}

//RememberForever Get an item from the cache, or execute the given Closure and store the result forever.
// RememberForever Get an item from the cache, or execute the given Closure and store the result forever.
func (r *Store) RememberForever(key string, callback func() (any, error)) (any, error) {
return "", nil
}
Expand Down
2 changes: 1 addition & 1 deletion cache/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/suite"

configmock "github.com/goravel/framework/contracts/config/mocks"
configmock "github.com/goravel/framework/mocks/config"
)

type MemoryTestSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions console/console/key_generate_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/assert"

configmock "github.com/goravel/framework/contracts/config/mocks"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
configmock "github.com/goravel/framework/mocks/config"
consolemocks "github.com/goravel/framework/mocks/console"
"github.com/goravel/framework/support"
"github.com/goravel/framework/support/file"
)
Expand Down
2 changes: 1 addition & 1 deletion console/console/make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/assert"

consolemocks "github.com/goravel/framework/contracts/console/mocks"
consolemocks "github.com/goravel/framework/mocks/console"
"github.com/goravel/framework/support/file"
)

Expand Down
12 changes: 11 additions & 1 deletion contracts/auth/access/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@ package access

import "context"

//go:generate mockery --name=Gate
type Gate interface {
// WithContext returns a new Gate instance with the given context.
WithContext(ctx context.Context) Gate
// Allows determines if the given ability should be granted for the current user.
Allows(ability string, arguments map[string]any) bool
// Denies determines if the given ability should be denied for the current user.
Denies(ability string, arguments map[string]any) bool
// Inspect the given ability against the current user.
Inspect(ability string, arguments map[string]any) Response
// Define a new ability.
Define(ability string, callback func(ctx context.Context, arguments map[string]any) Response)
// Any one of the given abilities should be granted for the current user.
Any(abilities []string, arguments map[string]any) bool
// None of the given abilities should be granted for the current user.
None(abilities []string, arguments map[string]any) bool
// Before register a callback to run before all Gate checks.
Before(callback func(ctx context.Context, ability string, arguments map[string]any) Response)
// After register a callback to run after all Gate checks.
After(callback func(ctx context.Context, ability string, arguments map[string]any, result Response) Response)
}

type Response interface {
// Allowed to determine if the response was allowed.
Allowed() bool
// Message to get the response message.
Message() string
}
8 changes: 7 additions & 1 deletion contracts/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ import (
"github.com/goravel/framework/contracts/http"
)

//go:generate mockery --name=Auth
type Auth interface {
// Guard attempts to get the guard against the local cache.
Guard(name string) Auth
// Parse the given token.
Parse(ctx http.Context, token string) (*Payload, error)
// User returns the current authenticated user.
User(ctx http.Context, user any) error
// Login logs a user into the application.
Login(ctx http.Context, user any) (token string, err error)
// LoginUsingID logs the given user ID into the application.
LoginUsingID(ctx http.Context, id any) (token string, err error)
// Refresh the token for the current user.
Refresh(ctx http.Context) (token string, err error)
// Logout logs the user out of the application.
Logout(ctx http.Context) error
}

Expand Down
Loading