cgorm

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

README

gorm组件

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

Install

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

Quick Start

import cgorm "github.com/actorgo-game/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