github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/core/changestream/change.go (about)

     1  // Copyright 2023 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package changestream
     5  
     6  // ChangeType represents the type of change.
     7  // The changes are bit flags so that they can be combined.
     8  type ChangeType int
     9  
    10  const (
    11  	// Create represents a new row in the database.
    12  	Create ChangeType = 1 << iota
    13  	// Update represents an update to an existing row in the database.
    14  	Update
    15  	// Delete represents a row that has been deleted from the database.
    16  	Delete
    17  )
    18  
    19  // ChangeEvent represents a new change set via the changestream.
    20  type ChangeEvent interface {
    21  	// Type returns the type of change (create, update, delete).
    22  	Type() ChangeType
    23  	// Namespace returns the namespace of the change. This is normally the
    24  	// table name.
    25  	Namespace() string
    26  	// ChangedUUID returns the entity UUID of the change.
    27  	ChangedUUID() string
    28  }