entity

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCaptcha

func CreateCaptcha() string

func GetActionByPb

func GetActionByPb(action proto.Action) consts.BranchAction

func GetGid

func GetGid() string

func GetTranTypeByPb

func GetTranTypeByPb(protoType proto.TranType) consts.TransactionType

Types

type Branch

type Branch struct {
	GID        string                 `gorm:"column:g_id;not null" bson:"g_id"`                      // global id
	BranchId   string                 `gorm:"column:branch_id;not null" bson:"branch_id"`            // branch id
	Url        string                 `gorm:"column:url;not null" bson:"url"`                        // branch request url (example grpc or http)
	ReqData    string                 `gorm:"column:req_data;not null" bson:"req_data"`              // request data
	ReqHeader  string                 `gorm:"column:req_header;not null" bson:"req_header"`          // request data
	TranType   consts.TransactionType `gorm:"column:tran_type;not null" bson:"tran_type"`            // transaction type:tcc or saga or others
	Protocol   string                 `gorm:"column:protocol;not null;default:http" bson:"protocol"` //http,grpc
	Action     consts.BranchAction    `gorm:"column:action;not null" bson:"action"`                  // action type of transaction
	State      consts.BranchState     `gorm:"column:state;not null;default:init" bson:"state"`       // branch State
	Level      consts.Level           `gorm:"column:level;not null;default:1" bson:"level"`          // branch level in tree
	LastErrMsg string                 `gorm:"column:last_err_msg;not null" bson:"last_err_msg"`
	Timeout    int64                  `gorm:"column:timeout;not null;default:0" bson:"timeout"`                 //request branch timeout(seconds)
	CreateTime int64                  `gorm:"create_time;autoCreateTime" json:"create_time" bson:"create_time"` // create time
	UpdateTime int64                  `gorm:"update_time;autoCreateTime" json:"update_time" bson:"update_time"` // last update time

}

func (*Branch) AssignmentByPb

func (b *Branch) AssignmentByPb(m *proto.RegisterReq_Branch) *Branch

AssignmentByPb todo

func (*Branch) IsTcc

func (b *Branch) IsTcc() bool

func (*Branch) SAGA

func (b *Branch) SAGA() bool

func (*Branch) SAGACompensation

func (b *Branch) SAGACompensation() bool

func (*Branch) SAGANormal

func (b *Branch) SAGANormal() bool

func (*Branch) Success

func (b *Branch) Success() bool

func (*Branch) TableName

func (b *Branch) TableName() string

func (*Branch) TccCancel

func (b *Branch) TccCancel() bool

func (*Branch) TccConfirm

func (b *Branch) TccConfirm() bool

func (*Branch) TccTry

func (b *Branch) TccTry() bool

type BranchList

type BranchList []*Branch

func GetBranchList

func GetBranchList(gid string, mList []*proto.RegisterReq_Branch) (list BranchList)

type Global

type Global struct {
	GID          string             `gorm:"column:g_id;type:varchar(255);not null" bson:"g_id"`                      // global id
	State        consts.GlobalState `gorm:"column:state;type:varchar(255);not null;default:init" bson:"state"`       // global State
	EndTime      int64              `gorm:"column:end_time;type:int;not null;default:0" bson:"end_time"`             // end time for the transaction
	TryTimes     int64              `gorm:"column:try_times;type:int;not null;default:0" bson:"try_times"`           // try times
	NextCronTime int64              `gorm:"column:next_cron_time;type:int;not null;default:0" bson:"next_cron_time"` // next cron time
	CreateTime   int64              `gorm:"create_time;autoCreateTime" json:"create_time" bson:"create_time"`        // create time
	UpdateTime   int64              `gorm:"update_time;autoCreateTime" json:"update_time" bson:"update_time"`        // last update time
}

func NewGlobal

func NewGlobal(gId string) *Global

func (*Global) AllowRegister

func (g *Global) AllowRegister() bool

func (*Global) GetEndTime

func (g *Global) GetEndTime() int64

func (*Global) GetGId

func (g *Global) GetGId() string

func (*Global) GetState

func (g *Global) GetState() consts.GlobalState

func (*Global) GotoCommit

func (g *Global) GotoCommit() bool

func (*Global) GotoRollback

func (g *Global) GotoRollback() bool

func (*Global) Init

func (g *Global) Init() bool

func (*Global) IsEmpty

func (g *Global) IsEmpty() bool

func (*Global) Phase1

func (g *Global) Phase1() bool

func (*Global) Phase2

func (g *Global) Phase2() bool

func (*Global) SetGId

func (g *Global) SetGId(gId string)

func (*Global) SetState

func (g *Global) SetState(state consts.GlobalState)

func (*Global) TableName

func (g *Global) TableName() string

Jump to

Keyboard shortcuts

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