sdk

package
v0.0.0-...-8572fe3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LOGGER       *logger.Logger
	AppName      string
	TRACER       *zipkin.Tracer
	DB           *gorm.DB
	KafkaAddress string
	KafkaGroupId string
	Server       string
)
View Source
var SECONDBASER_PREFIX_TOPIC = "SECONDBASER_TRANSACTIONAL_"

Functions

func CloseConn

func CloseConn(conn *grpc.ClientConn)

func FollowTransactionTemplate

func FollowTransactionTemplate(ctx context.Context, process func() error, rollback func(bizContext BusinessTransactionContext) error, forward func(bizContext BusinessTransactionContext) error) error

func GetConn

func GetConn() (*grpc.ClientConn, error)

func InitSecondbaserClient

func InitSecondbaserClient(db *sql.DB, tracer *zipkin.Tracer, logLevel string, kafkaBrokerAddr string, appGroup string, appName string, secondBaserServer string)

func SetLogFormat

func SetLogFormat(ctx context.Context)

func TransactionInitTemplate

func TransactionInitTemplate(ctx context.Context, t *zipkin.Tracer, businessType string, bizId string, process func(injectedContext context.Context) error) error

Types

type ActionType

type ActionType string
var (
	ACTION_TYPE_COMMIT   ActionType = "COMMIT"
	ACTION_TYPE_ROLLBACK ActionType = "ROLLBACK"
)

type BusinessTransactionContext

type BusinessTransactionContext struct {
	Initiator string `json:"initiator"`

	TransactionId string `json:"transaction_id"`

	BusinessId string `json:"business_id"`

	BusinessType string `json:"business_type"`

	TransactionTime time.Time `json:"transaction_time"`

	FinishPhaseTime time.Time `json:"finish_phase_time"`

	ActionType ActionType `json:"action_type"`
}

Jump to

Keyboard shortcuts

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