Documentation
¶
Index ¶
Constants ¶
const (
// Version is the current version of the Celeritas framework.
Version = "1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Celeritas ¶
type Celeritas struct { AppName string Debug bool Version string ErrorLog *log.Logger InfoLog *log.Logger RootPath string Routes *chi.Mux Render *render.Render // contains filtered or unexported fields }
Celeritas is the main struct for the Celeritas framework.
func (*Celeritas) CreateDirIfNotExist ¶
CreateDirIfNotExist is a method on the Celeritas struct. It checks if a directory at the provided path exists. If the directory does not exist, it creates the directory with the specified mode. The mode is set to 0755, which means the owner can read, write, and execute, while others can read and execute but not write.
Parameters: path: A string representing the path of the directory to check or create.
Returns: If the directory exists or is successfully created, it returns nil. If there is an error creating the directory, it returns the error.
func (*Celeritas) CreateFileIfNotExist ¶
CreateFileIfNotExist is a method on the Celeritas struct. It checks if a file at the provided path exists. If the file does not exist, it creates the file with the specified mode. The mode is set to 0644, which means the owner can read and write, while others can only read.
Parameters: path: A string representing the path of the file to check or create.
Returns: If the file exists or is successfully created, it returns nil. If there is an error creating the file, it returns the error.
func (*Celeritas) Init ¶
Init initializes the directory structure for a Celeritas project. It takes an initPaths struct as an argument which contains the root path and the names of the folders to be created. It iterates over the folder names, and for each one, it calls the CreateDirIfNotExist method. If the CreateDirIfNotExist method returns an error, it immediately returns this error. If no errors occur during the folder creation, it returns nil.
func (*Celeritas) ListenAndServe ¶ added in v1.0.3
func (c *Celeritas) ListenAndServe()
ListenAndServe starts the HTTP server and listens for incoming requests. It configures the server with the provided settings and routes, and logs any errors that occur during server startup or shutdown.