Skip to content

Commit d2be30a

Browse files
hwbrzzlkkumar-gcc
andauthored
feat: upgrade v1.15.0 (#67)
* init * add filter doc * add mail * add filter * add strings methods * optimize worker method * add stream * Add Auth.Id method * Validation supports Regex rules * The name of Postgresql driver changes to Postgres * Upgrade golang version * replace sqlserver docker image * add some new features * add mail * Add mail * update * add comment service to remaining pages * add basic docs for http tests * add docs for `AssertJson` and `AssertExactJson` * add available assertions method * add docs for fluent string * add migration doc * add migration docs, TODO: add 列修饰符 * add migration docs * Sync CN and EN * fix typo * add docs * feat: [#515] Input* methods of http.Request support retrieve data from query and route * feat: [#517] different guards can configure own ttl * add doc for scoping of JSON collection * add doc for scoping of JSON collection * feat: [#282] Print the values in ctx when calling facades.Log().WithContext(ctx).Info() * feat: [#272] The Orm module can set DSN directly * chore: rename Stop to Shutdown * feat: [#477] Configure camel case columns instead of snake case GORM * chore: optimize artisan style * optimize words * feat: [#508] Add Restore method for Orm, to recover soft deleted dataoptimize lint * feat: [#473] ORM has its own logger instead of using facades.Log() * feat: Add artisan about command * fix typo * feat: postgres and sqlserver drivers support setting schema * feat: Optimize testing.http * optimize sort * optimize * optimize upgrade process * add goravel/installer * add recovery * add abort method * fix: typo * add comment * fix typo * upgrade: v1.15.1 * upgrade packages * upgrade cloudinay --------- Co-authored-by: kkumar-gcc <[email protected]>
1 parent d508faf commit d2be30a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3909
-266
lines changed

Diff for: .vuepress/config/sidebar/en.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export function getEnSidebar(): SidebarConfigArray {
1010
text: "Upgrade Guide",
1111
children: [
1212
{
13-
text: "Upgrading To v1.14 From v1.13",
14-
link: "/upgrade/v1.14",
13+
text: "Upgrading To v1.15 From v1.14",
14+
link: "/upgrade/v1.15",
1515
},
1616
{
17-
text: "Upgrading To v1.13 From v1.12",
18-
link: "/upgrade/v1.13",
17+
text: "Upgrading To v1.14 From v1.13",
18+
link: "/upgrade/v1.14",
1919
},
2020
{
2121
text: "History Upgrade",
@@ -233,6 +233,10 @@ export function getEnSidebar(): SidebarConfigArray {
233233
text: "Getting Started",
234234
link: "/testing/getting-started",
235235
},
236+
{
237+
text: "HTTP Tests",
238+
link: "/testing/htt-tests",
239+
},
236240
{
237241
text: "Mock",
238242
link: "/testing/mock",

Diff for: .vuepress/config/sidebar/zh.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export function getZhSidebar(): SidebarConfigArray {
1010
text: "升级指南",
1111
children: [
1212
{
13-
text: "从 v1.13 升级到 v1.14",
14-
link: "/zh/upgrade/v1.14",
13+
text: "从 v1.14 升级到 v1.15",
14+
link: "/zh/upgrade/v1.15",
1515
},
1616
{
17-
text: "从 v1.12 升级到 v1.13",
18-
link: "/zh/upgrade/v1.13",
17+
text: "从 v1.13 升级到 v1.14",
18+
link: "/zh/upgrade/v1.14",
1919
},
2020
{
2121
text: "历史版本升级",
@@ -233,6 +233,10 @@ export function getZhSidebar(): SidebarConfigArray {
233233
text: "快速入门",
234234
link: "/zh/testing/getting-started",
235235
},
236+
{
237+
text: "HTTP Tests",
238+
link: "/zh/testing/htt-tests",
239+
},
236240
{
237241
text: "Mock",
238242
link: "/zh/testing/mock",

Diff for: digging-deeper/color.md

+2
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ import "github.com/goravel/framework/support/color"
5050

5151
color.New(color.FgRed).Println("Hello, Goravel!")
5252
```
53+
54+
<CommentService/>

Diff for: digging-deeper/helpers.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ path := path.Config("app.go")
8686

8787
### `path.Database()`
8888

89-
The `path.Database()` function returns the path to your application's database directory. You may also use the `path.Database()` function to generate a path to a given file within the database directory:
89+
The `path.Database()` function returns the path to your application's database directory. You may also use the `path.Database()` function to generate a path to a given file within the `database` directory:
9090

9191
```go
9292
path := path.Database()
@@ -95,7 +95,7 @@ path := path.Database("factories/user_factory.go")
9595

9696
### `path.Storage()`
9797

98-
The `path.Storage()` function returns the path to your application's storage directory. You may also use the `path.Storage()` function to generate a path to a given file within the storage directory:
98+
The `path.Storage()` function returns the path to your application's storage directory. You may also use the `path.Storage()` function to generate a path to a given file within the `storage` directory:
9999

100100
```go
101101
path := path.Storage()
@@ -104,13 +104,22 @@ path := path.Storage("app/file.txt")
104104

105105
### `path.Public()`
106106

107-
The `path.Public()` function returns the path to your application's public directory. You may also use the `path.Public()` function to generate a path to a given file within the public directory:
107+
The `path.Public()` function returns the path to your application's public directory. You may also use the `path.Public()` function to generate a path to a given file within the `public` directory:
108108

109109
```go
110110
path := path.Public()
111111
path := path.Public("css/app.css")
112112
```
113113

114+
### `path.Lang()`
115+
116+
The `path.Lang()` function returns the path to the `lang` directory. You may also use the `path.Lang()` function to generate a path to a given file within the `lang` directory:
117+
118+
```go
119+
path := path.Lang()
120+
path := path.Lang("en.json")
121+
```
122+
114123
## Time
115124

116125
The `carbon` module of Goravel is an expansion by [golang-module/carbon](https://github.com/golang-module/carbon), the main feature is the realization of time backtracking, please refer to the official documentation for details.

Diff for: digging-deeper/localization.md

+2
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,5 @@ facades.Lang(ctx).Choice("time.minutes_ago", 5, translation.Option{
152152
},
153153
})
154154
```
155+
156+
<CommentService/>

Diff for: digging-deeper/mail.md

+64-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ err := facades.Mail().To([]string{"[email protected]"}).
1919
Cc([]string{"[email protected]"}).
2020
Bcc([]string{"[email protected]"}).
2121
Attach([]string{"file.png"}).
22-
Content(mail.Content{Subject: "Subject", Html: "<h1>Hello Goravel</h1>"}).
22+
Content(mail.Html("<h1>Hello Goravel</h1>")).
23+
Subject("Subject").
2324
Send()
2425
```
2526

@@ -32,7 +33,8 @@ err := facades.Mail().To([]string{"[email protected]"}).
3233
Cc([]string{"[email protected]"}).
3334
Bcc([]string{"[email protected]"}).
3435
Attach([]string{"file.png"}).
35-
Content(mail.Content{Subject: "Subject", Html: "<h1>Hello Goravel</h1>"}).
36+
Content(mail.Html("<h1>Hello Goravel</h1>")).
37+
Subject("Subject").
3638
Queue()
3739
```
3840

@@ -45,8 +47,9 @@ err := facades.Mail().To([]string{"[email protected]"}).
4547
Cc([]string{"[email protected]"}).
4648
Bcc([]string{"[email protected]"}).
4749
Attach([]string{"file.png"}).
48-
Content(mail.Content{Subject: "Subject", Html: "<h1>Hello Goravel</h1>"}).
49-
Queue(mail.Queue{Connection: "high", Queue: "mail"})
50+
Content(mail.Html("<h1>Hello Goravel</h1>")).
51+
Subject("Subject").
52+
Queue(mail.Queue().Connection("high").Queue("mail"))
5053
```
5154

5255
## Setting Sender
@@ -57,12 +60,66 @@ Framework uses `MAIL_FROM_ ADDRESS` and `MAIL_FROM_ NAME` in the `config/mail.go
5760
import "github.com/goravel/framework/contracts/mail"
5861

5962
err := facades.Mail().To([]string{"[email protected]"}).
60-
From(mail.From{Address: "[email protected]", Name: "example"}).
63+
From(mail.Address(testFromAddress, testFromName)).
6164
Cc([]string{"[email protected]"}).
6265
Bcc([]string{"[email protected]"}).
6366
Attach([]string{"file.png"}).
64-
Content(mail.Content{Subject: "Subject", Html: "<h1>Hello Goravel</h1>"}).
65-
Queue(mail.Queue{Connection: "high", Queue: "mail"})
67+
Content(mail.Html("<h1>Hello Goravel</h1>")).
68+
Subject("Subject").
69+
Queue(mail.Queue().Connection("high").Queue("mail"))
70+
```
71+
72+
## Using Mailable
73+
74+
The parameters of the email can be set in a `Mailable` struct. These structs are stored in the `app/mails` directory. You can quickly create a `Mailable` using the `make:mail` Artisan command:
75+
76+
```bash
77+
go run . artisan make:mail OrderShipped
78+
```
79+
80+
The generated `OrderShipped` struct is as follows:
81+
82+
```go
83+
import "github.com/goravel/framework/contracts/mail"
84+
85+
type OrderShipped struct {
86+
}
87+
88+
func NewOrderShipped() *OrderShipped {
89+
return &OrderShipped{}
90+
}
91+
92+
func (m *OrderShipped) Attachments() []string {
93+
return []string{"../logo.png"}
94+
}
95+
96+
func (m *OrderShipped) Content() *mail.Content {
97+
return &mail.Content{Html: "<h1>Hello Goravel</h1>"}
98+
}
99+
100+
func (m *OrderShipped) Envelope() *mail.Envelope {
101+
return &mail.Envelope{
102+
Bcc: []string{"[email protected]"},
103+
Cc: []string{"[email protected]"},
104+
From: mail.From{Address: "[email protected]", Name: "from"},
105+
Subject: "Goravel",
106+
To: []string{"[email protected]"},
107+
}
108+
}
109+
110+
func (m *OrderShipped) Queue() *mail.Queue {
111+
return &mail.Queue{
112+
Connection: "high",
113+
Queue: "mail",
114+
}
115+
}
116+
```
117+
118+
Then you can use the `Mailalbe` in the `Send` and `Queue` methods:
119+
120+
```go
121+
err := facades.Mail().Send(mails.NewOrderShipped())
122+
err := facades.Mail().Queue(mails.NewOrderShipped())
66123
```
67124

68125
<CommentService/>

Diff for: digging-deeper/package-development.md

+2
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,5 @@ The command can use the following options:
122122
| --tag | -t | Resource Group |
123123
| --force | -f | Overwrite any existing files |
124124
| --existing | -e | Publish and overwrite only the files that have already been published |
125+
126+
<CommentService/>

Diff for: digging-deeper/queues.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func main() {
9191

9292
// Start queue server by facades.Queue().
9393
go func() {
94-
if err := facades.Queue().Worker(nil).Run(); err != nil {
94+
if err := facades.Queue().Worker().Run(); err != nil {
9595
facades.Log().Errorf("Queue run error: %v", err)
9696
}
9797
}()
@@ -105,14 +105,14 @@ Different parameters can be passed in the `facades.Queue().Worker` method, you c
105105
```go
106106
// No parameters, default listens to the configuration in the `config/queue.go`, and the number of concurrency is 1
107107
go func() {
108-
if err := facades.Queue().Worker(nil).Run(); err != nil {
108+
if err := facades.Queue().Worker().Run(); err != nil {
109109
facades.Log().Errorf("Queue run error: %v", err)
110110
}
111111
}()
112112

113113
// Monitor processing queue for redis link, and the number of concurrency is 10
114114
go func() {
115-
if err := facades.Queue().Worker(&queue.Args{
115+
if err := facades.Queue().Worker(queue.Args{
116116
Connection: "redis",
117117
Queue: "processing",
118118
Concurrent: 10,

Diff for: digging-deeper/strings.md

+22
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ import "github.com/goravel/framework/support/str"
126126
str.Of("Goravel").CharAt(1) // "o"
127127
```
128128

129+
### `ChopEnd`
130+
131+
The `ChopEnd` method removes the given value(s) from the end of the string.
132+
133+
```go
134+
import "github.com/goravel/framework/support/str"
135+
136+
str.Of("https://goravel.com").ChopEnd(".dev", ".com").String() // https://goravel
137+
```
138+
139+
### `ChopStart`
140+
141+
The `ChopStart` method removes the given value(s) from the start of the string.
142+
143+
```go
144+
import "github.com/goravel/framework/support/str"
145+
146+
str.Of("https://goravel.dev").ChopStart("http://", "https://").String() // goravel.dev
147+
```
148+
129149
### `Contains`
130150

131151
The `Contains` method determines if the given string contains the given value. The method is case-sensitive. If multiple values are provided, it will return `true` if the string contains any of the values.
@@ -1017,3 +1037,5 @@ str.Of("Hello, World!").Words(1) // "Hello..."
10171037

10181038
str.Of("Hello, World!").Words(1, " (****)") // "Hello (****)"
10191039
```
1040+
1041+
<CommentService/>

Diff for: digging-deeper/task-scheduling.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ func (kernel *Kernel) Schedule() []schedule.Event {
5858
}
5959
```
6060

61+
### Logging Level
62+
63+
When `app.debug` is `true`, the console will print all logs. Otherwise, only `error` level logs will be printed.
64+
6165
### Schedule Frequency Options
6266

6367
We've already seen a few examples of how you may configure a task to run at specified intervals. However, there are many more task schedule frequencies avaibable to assign to tasks:
@@ -142,4 +146,32 @@ func main() {
142146
}
143147
```
144148

145-
<CommentService/>
149+
## Stopping The Scheduler
150+
151+
You can call the `Shutdown` method to gracefully shut down the scheduler. This method will wait for all tasks to complete before shutting down.
152+
153+
```go
154+
// main.go
155+
bootstrap.Boot()
156+
157+
// Create a channel to listen for OS signals
158+
quit := make(chan os.Signal)
159+
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
160+
161+
// Start schedule by facades.Schedule
162+
go facades.Schedule().Run()
163+
164+
// Listen for the OS signal
165+
go func() {
166+
<-quit
167+
if err := facades.Schedule().Shutdown(); err != nil {
168+
facades.Log().Errorf("Schedule Shutdown error: %v", err)
169+
}
170+
171+
os.Exit(0)
172+
}()
173+
174+
select {}
175+
```
176+
177+
<CommentService/>

Diff for: getting-started/configuration.md

+8
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,12 @@ facades.Config().Add("path.with.dot.case1", "value1")
5151
facades.Config().Add("path.with.dot", map[string]any{"case3": "value3"})
5252
```
5353

54+
## Get Project Information
55+
56+
You can use the `artisan about` command to view the framework version, configuration, etc.
57+
58+
```bash
59+
go run . artisan about
60+
```
61+
5462
<CommentService/>

0 commit comments

Comments
 (0)