entx

package
v0.0.0-...-dfe096b Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSet

type ClientSet struct {
	// contains filtered or unexported fields
}

func NewClientSet

func NewClientSet(primary *ent.Client, opts ...ClientSetOption) *ClientSet

func (*ClientSet) Close

func (c *ClientSet) Close() error

func (*ClientSet) Primary

func (c *ClientSet) Primary() *ent.Client

func (*ClientSet) Replica

func (c *ClientSet) Replica() *ent.Client

type ClientSetOption

type ClientSetOption func(*ClientSet)

func WithPolicy

func WithPolicy(policy Policy) ClientSetOption

func WithReplicas

func WithReplicas(replicas []*ent.Client) ClientSetOption

type ClientType

type ClientType int

type Policy

type Policy interface {
	Resolve([]*ent.Client) *ent.Client
}

type RandomClientSetPolicy

type RandomClientSetPolicy struct{}

func (*RandomClientSetPolicy) Resolve

func (p *RandomClientSetPolicy) Resolve(clients []*ent.Client) *ent.Client

type RoundRobinPolicy

type RoundRobinPolicy struct {
	// contains filtered or unexported fields
}

func (*RoundRobinPolicy) Resolve

func (p *RoundRobinPolicy) Resolve(clients []*ent.Client) *ent.Client

Jump to

Keyboard shortcuts

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