github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/internal/tx/id.go (about)

     1  package tx
     2  
     3  var _ Identifier = LazyID{}
     4  
     5  const (
     6  	LazyTxID = "LAZY_TX"
     7  )
     8  
     9  type (
    10  	Identifier interface {
    11  		ID() string
    12  		isYdbTx()
    13  	}
    14  	LazyID struct {
    15  		v *string
    16  	}
    17  )
    18  
    19  func (id LazyID) ID() string {
    20  	if id.v == nil {
    21  		return LazyTxID
    22  	}
    23  
    24  	return *id.v
    25  }
    26  
    27  func (id *LazyID) SetTxID(txID string) {
    28  	id.v = &txID
    29  }
    30  
    31  func (id LazyID) isYdbTx() {}
    32  
    33  func ID(id string) LazyID {
    34  	return LazyID{v: &id}
    35  }