cherryGORM

package module
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 9 Imported by: 1

README

gorm组件

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

Install

Prerequisites
  • GO >= 1.17
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

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