gb Framework

website·Indexed 30 days ago

https://ghostbb.io/

A modular, low-coupling development framework for Go featuring a variety of common components including database ORM (using gorm), NoSQL Redis, cache management, and integration with the Gin web framework.

Tokens
2.7K
Snippets
25
Records
29
Agent score
48%

What's inside gb

  1. Overview of the gb development framework

    gb is a modular, low-coupling development framework for Go. It provides a set of common components that can be used together or as an independent component library. Core components include cache management, a Database ORM, and NoSQL support (specifically Redis).
  2. Overview of gb core components

    gb is a modular, low-coupling development framework that provides several common components which can also be used as an independent component library. Core components include:

    • Cache Management
    • Database ORM
    • NoSQL support (specifically Redis)
  3. Overview of Gin Web Framework

    Gin is a high-performance web framework written in Go. It features a Martini-like API and utilizes a custom version of httprouter to achieve high performance. Key features include a zero-allocation router, middleware support, JSON validation, route grouping, error management, built-in rendering, and extensibility.
  4. Gin framework features and prerequisites

    Gin is a high-performance Go web framework featuring a zero-allocation router, middleware support, JSON validation, route grouping, and built-in rendering.

    Prerequisites:

    • Go: Any one of the three latest major releases.
  5. Install Gin Web Framework

    To use Gin, ensure you are using one of the three most recent major versions of Go. You can add Gin to your project using Go modules by adding the import statement to your code, or by installing the package via the CLI.
    # Install via Go CLI
    go get -u github.com/gin-gonic/gin
    // Import in your code
    import "github.com/gin-gonic/gin"
  6. Install the GhostBB dbcache plugin

    The dbcache plugin provides a simple database caching layer for GhostBB. Install it using the Go toolchain.
    go get -u ghostbb.io/gb/contrib/dbcache
  7. Configure database connections in GhostBB

    GhostBB uses a configuration component to manage database settings. To obtain a database operation object, use the g.DB("group_name") method, which automatically loads the configuration associated with that group name from the config file.
    // Example of retrieving a database object by group name
    db := g.DB("default")
  8. Install GhostBB database drivers

    GhostBB supports multiple database drivers. Install the driver corresponding to your database using the following Go commands:
    # For MSSQL
    go get -u ghostbb.io/gb/contrib/drivers/mssql
    
    # For MySQL
    go get -u ghostbb.io/gb/contrib/drivers/mysql
    
    # For PostgreSQL
    go get -u ghostbb.io/gb/contrib/drivers/pgsql
  9. Install the Gin web framework

    To use Gin in a project with Go module support, add the import github.com/gin-gonic/gin to your code; dependencies will be fetched automatically during go build, go run, or go test. Alternatively, you can install the package manually using the Go CLI.
    go get -u github.com/gin-gonic/gin
  10. Install GhostBB database drivers

    GhostBB uses GORM for database operations. Depending on the target database (Microsoft SQL Server, MySQL, or PostgreSQL), install the corresponding driver using the Go toolchain.
    # For MSSQL
    go get -u ghostbb.io/gb/contrib/driver/mssql
    
    # For MySQL
    go get -u ghostbb.io/gb/contrib/driver/mysql
    
    # For PostgreSQL
    go get -u ghostbb.io/gb/contrib/driver/pgsql
  11. Install the gb framework using Go

    To install the gb framework, ensure you have Go version 1.20 or higher installed on your system. Use the go get command to install the package.
    go get -u ghostbb.io/gb