Skip to content

Commit

Permalink
Restore
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed3mar committed Oct 12, 2023
1 parent acb2b20 commit 25ea367
Show file tree
Hide file tree
Showing 186 changed files with 669 additions and 3,075 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [ opened, reopened, synchronize, labeled ]

jobs:
test:
if: ${{ contains(github.event.pull_request.labels.*.name, '🚀 Review Ready') }}
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_ENDPOINT: https://api.openai-sb.com/v1
MODEL: gpt-3.5-turbo
PROMPT: "Below is a code patch, please help me do a brief code review on it. Only answer important bug risks and/or important improvement suggestions, Answer must be concisely and short: "
19 changes: 0 additions & 19 deletions .github/workflows/mockery.yml

This file was deleted.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ This project exists thanks to all the people who contribute, to participate in t
<a href="https://github.com/Marian0" target="_blank"><img src="https://avatars.githubusercontent.com/u/624592?v=4" width="48" height="48"></a>
<a href="https://github.com/ahmed3mar" target="_blank"><img src="https://avatars.githubusercontent.com/u/12982325?v=4" width="48" height="48"></a>
<a href="https://github.com/flc1125" target="_blank"><img src="https://avatars.githubusercontent.com/u/14297703?v=4" width="48" height="48"></a>
<a href="https://github.com/zzpwestlife" target="_blank"><img src="https://avatars.githubusercontent.com/u/12382180?v=4" width="48" height="48"></a>

## Sponsor

Better development of the project is inseparable from your support, reward us by [Open Collective](https://opencollective.com/goravel).

<p align="left"><img src="https://www.goravel.dev/reward.png" width="200"></p>

## Group

Expand Down
7 changes: 7 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ Laravel!
<a href="https://github.com/Marian0" target="_blank"><img src="https://avatars.githubusercontent.com/u/624592?v=4" width="48" height="48"></a>
<a href="https://github.com/ahmed3mar" target="_blank"><img src="https://avatars.githubusercontent.com/u/12982325?v=4" width="48" height="48"></a>
<a href="https://github.com/flc1125" target="_blank"><img src="https://avatars.githubusercontent.com/u/14297703?v=4" width="48" height="48"></a>
<a href="https://github.com/zzpwestlife" target="_blank"><img src="https://avatars.githubusercontent.com/u/12382180?v=4" width="48" height="48"></a>

## 打赏

开源项目的发展离不开您的支持,感谢微信打赏。

<p align="left"><img src="https://www.goravel.dev/reward-wechat.jpg" width="200"></p>

## 群组

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/mocks/config"
consolemocks "github.com/goravel/framework/mocks/console"
configmock "github.com/goravel/framework/contracts/config/mocks"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
"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/mocks/console"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
"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/mocks/config"
logmock "github.com/goravel/framework/mocks/log"
configmock "github.com/goravel/framework/contracts/config/mocks"
logmock "github.com/goravel/framework/contracts/log/mocks"
)

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/mocks/config"
configmock "github.com/goravel/framework/contracts/config/mocks"
)

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/mocks/config"
consolemocks "github.com/goravel/framework/mocks/console"
configmock "github.com/goravel/framework/contracts/config/mocks"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
"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/mocks/console"
consolemocks "github.com/goravel/framework/contracts/console/mocks"
"github.com/goravel/framework/support/file"
)

Expand Down
1 change: 1 addition & 0 deletions contracts/auth/access/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contracts/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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
Expand Down
31 changes: 10 additions & 21 deletions mocks/auth/Auth.go → contracts/auth/mocks/Auth.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions contracts/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import (
"time"
)

//go:generate mockery --name=Cache
type Cache interface {
Driver
Store(name string) Driver
}

//go:generate mockery --name=Driver
type Driver interface {
// Add an item in the cache if the key does not exist.
Add(key string, value any, t time.Duration) bool
Expand Down Expand Up @@ -49,6 +51,7 @@ type Driver interface {
WithContext(ctx context.Context) Driver
}

//go:generate mockery --name=Lock
type Lock interface {
// Block attempt to acquire the lock for the given number of seconds.
Block(t time.Duration, callback ...func()) bool
Expand Down
Loading

0 comments on commit 25ea367

Please sign in to comment.