[[toc]]
path.App() | path.Base() | path.Config() |
path.Database() | path.Storage() | path.Public() |
debug.Dump() | debug.SDump() | debug.FDump() |
The path.App()
function returns the path to your application's app directory. You may also use the path.App()
function to generate a path to a file relative to the application directory:
import "github.com/goravel/framework/support/path"
path := path.App()
path := path.App("http/controllers/controller.go")
The path.Base()
function returns the path to your application's root directory. You may also use the path.Base()
function to generate a path to a given file relative to the project root directory:
path := path.Base()
path := path.Base("vendor/bin")
The path.Config()
function returns the path to your application's config directory. You may also use the path.Config()
function to generate a path to a given file within the application's configuration directory:
path := path.Config()
path := path.Config("app.go")
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:
path := path.Database()
path := path.Database("factories/user_factory.go")
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:
path := path.Storage()
path := path.Storage("app/file.txt")
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:
path := path.Public()
path := path.Public("css/app.css")
The carbon
module of Goravel is an expansion by golang-module/carbon, the main feature is the realization of time backtracking, please refer to the official documentation for details.
Get current time:
import "github.com/goravel/framework/carbon"
carbon.Now()
Set timezone:
carbon.SetTimezone(carbon.UTC)
Get Carbon
object by String:
carbon.Parse("2020-08-05 13:14:15")
Get Carbon
Object by timestamp:
carbon.FromTimestamp(1577836800)
Get Carbon
Object by date time:
carbon.FromDateTime(2020, 1, 1, 0, 0, 0)
Get Carbon
Object by date:
carbon.FromDate(2020, 1, 1)
Get Carbon
Object by time:
carbon.FromTime(0, 0, 0)
Get Carbon
Object by time.Time
:
carbon.FromStdTime(time.Now())
Determine whether the time is a test value:
carbon.IsTestNow()
Set the time to a test value:
carbon.SetTestNow(carbon.Now())
Restore the time to a normal value:
carbon.UnsetTestNow()
debug.Dump()
can print any variable:
import "github.com/goravel/framework/support/debug"
debug.Dump(myVar1, myVar2, ...)
debug.FDump()
can print any variable to io.Writer
:
import "github.com/goravel/framework/support/debug"
debug.FDump(someWriter, myVar1, myVar2, ...)
debug.SDump()
can print any variable to string
:
import "github.com/goravel/framework/support/debug"
debug.SDump(myVar1, myVar2, ...)