cherryGORM

package module
v1.3.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 9 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gorm组件

  • 基于gorm实现多数据实例管理

Install

Prerequisites
  • GO >= 1.18
Using go get
go get github.com/cherry-game/cherry/components/gorm@latest

Quick Start

import cherryGORM "github.com/cherry-game/cherry/components/gorm"

example

  • 请查看 examples/demo_gorm

Update

  • 数据库配置信息中添加dsn属性,未填写该属性时使用默认的dsn连接字符串

Documentation

Index

Constants

View Source
const (
	Name = "gorm_component"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	cfacade.Component
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent() *Component

func (*Component) GetDb

func (s *Component) GetDb(id string) *gorm.DB

func (*Component) GetDbMap

func (s *Component) GetDbMap(groupID string) (map[string]*gorm.DB, bool)

func (*Component) GetHashDb

func (s *Component) GetHashDb(groupID string, hashFn HashDb) (*gorm.DB, bool)

func (*Component) Init

func (s *Component) Init()

func (*Component) Name

func (s *Component) Name() string

type HashDb

type HashDb func(dbMaps map[string]*gorm.DB) string

HashDb hash by group id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL