Documentation ¶
Index ¶
- func CreateInternalClusterMember(ctx context.Context, tx *sql.Tx, object InternalClusterMember) (int64, error)
- func CreateInternalTokenRecord(ctx context.Context, tx *sql.Tx, object InternalTokenRecord) (int64, error)
- func DeleteInternalClusterMember(ctx context.Context, tx *sql.Tx, address string) error
- func DeleteInternalTokenRecord(ctx context.Context, tx *sql.Tx, name string) error
- func GetCallerProject() string
- func GetClusterMemberAPIExtensions(ctx context.Context, tx *sql.Tx) ([]extensions.Extensions, error)
- func GetClusterMemberSchemaVersions(ctx context.Context, tx *sql.Tx) (internalSchema []uint64, externalSchema []uint64, err error)
- func GetInternalClusterMemberID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetInternalTokenRecordID(ctx context.Context, tx *sql.Tx, secret string) (int64, error)
- func InternalClusterMemberExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func InternalTokenRecordExists(ctx context.Context, tx *sql.Tx, secret string) (bool, error)
- func PrepareStmts(db *sql.DB, project string, skipErrors bool) error
- func RegisterStmt(sql string) int
- func Stmt(tx *sql.Tx, code int) (*sql.Stmt, error)
- func StmtString(code int) (string, error)
- func UpdateClusterMemberAPIExtensions(tx *sql.Tx, apiExtensions extensions.Extensions, address string) error
- func UpdateClusterMemberSchemaVersion(tx *sql.Tx, internalVersion uint64, externalVersion uint64, address string) error
- func UpdateInternalClusterMember(ctx context.Context, tx *sql.Tx, name string, object InternalClusterMember) error
- type InternalClusterMember
- type InternalClusterMemberFilter
- type InternalTokenRecord
- type InternalTokenRecordFilter
- type Role
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateInternalClusterMember ¶
func CreateInternalClusterMember(ctx context.Context, tx *sql.Tx, object InternalClusterMember) (int64, error)
CreateInternalClusterMember adds a new internal_cluster_member to the database. generator: internal_cluster_member Create
func CreateInternalTokenRecord ¶
func CreateInternalTokenRecord(ctx context.Context, tx *sql.Tx, object InternalTokenRecord) (int64, error)
CreateInternalTokenRecord adds a new internal_token_record to the database. generator: internal_token_record Create
func DeleteInternalClusterMember ¶
DeleteInternalClusterMember deletes the internal_cluster_member matching the given key parameters. generator: internal_cluster_member DeleteOne-by-Address
func DeleteInternalTokenRecord ¶
DeleteInternalTokenRecord deletes the internal_token_record matching the given key parameters. generator: internal_token_record DeleteOne-by-Name
func GetCallerProject ¶
func GetCallerProject() string
GetCallerProject will get the go project name of whichever function called `GetCallerProject`.
func GetClusterMemberAPIExtensions ¶
func GetClusterMemberAPIExtensions(ctx context.Context, tx *sql.Tx) ([]extensions.Extensions, error)
GetClusterMemberAPIExtensions returns the API extensions from all cluster members that are not pending. This helper is non-generated to work before generated statements are loaded, as we update the API extensions.
func GetClusterMemberSchemaVersions ¶
func GetClusterMemberSchemaVersions(ctx context.Context, tx *sql.Tx) (internalSchema []uint64, externalSchema []uint64, err error)
GetClusterMemberSchemaVersions returns the schema versions from all cluster members that are not pending. This helper is non-generated to work before generated statements are loaded, as we update the schema.
func GetInternalClusterMemberID ¶
GetInternalClusterMemberID return the ID of the internal_cluster_member with the given key. generator: internal_cluster_member ID
func GetInternalTokenRecordID ¶
GetInternalTokenRecordID return the ID of the internal_token_record with the given key. generator: internal_token_record ID
func InternalClusterMemberExists ¶
InternalClusterMemberExists checks if a internal_cluster_member with the given key exists. generator: internal_cluster_member Exists
func InternalTokenRecordExists ¶
InternalTokenRecordExists checks if a internal_token_record with the given key exists. generator: internal_token_record Exists
func PrepareStmts ¶
PrepareStmts prepares all registered statements and stores them in preparedStmts.
func RegisterStmt ¶
RegisterStmt register a SQL statement.
Registered statements will be prepared upfront and re-used, to speed up execution.
Return a unique registration code.
func StmtString ¶
StmtString returns the in-memory query string with the given code.
func UpdateClusterMemberAPIExtensions ¶
func UpdateClusterMemberAPIExtensions(tx *sql.Tx, apiExtensions extensions.Extensions, address string) error
UpdateClusterMemberAPIExtensions sets the API extensions for the cluster member with the given address. This helper is non-generated to work before generated statements are loaded, as we update the API extensions.
func UpdateClusterMemberSchemaVersion ¶
func UpdateClusterMemberSchemaVersion(tx *sql.Tx, internalVersion uint64, externalVersion uint64, address string) error
UpdateClusterMemberSchemaVersion sets the schema version for the cluster member with the given address. This helper is non-generated to work before generated statements are loaded, as we update the schema.
func UpdateInternalClusterMember ¶
func UpdateInternalClusterMember(ctx context.Context, tx *sql.Tx, name string, object InternalClusterMember) error
UpdateInternalClusterMember updates the internal_cluster_member matching the given key parameters. generator: internal_cluster_member Update
Types ¶
type InternalClusterMember ¶
type InternalClusterMember struct { ID int Name string `db:"primary=yes"` Address string Certificate string SchemaInternal uint64 SchemaExternal uint64 APIExtensions extensions.Extensions Heartbeat time.Time Role Role }
InternalClusterMember represents the global database entry for a dqlite cluster member.
func GetInternalClusterMember ¶
func GetInternalClusterMember(ctx context.Context, tx *sql.Tx, name string) (*InternalClusterMember, error)
GetInternalClusterMember returns the internal_cluster_member with the given key. generator: internal_cluster_member GetOne
func GetInternalClusterMembers ¶
func GetInternalClusterMembers(ctx context.Context, tx *sql.Tx, filters ...InternalClusterMemberFilter) ([]InternalClusterMember, error)
GetInternalClusterMembers returns all available internal_cluster_members. generator: internal_cluster_member GetMany
func (InternalClusterMember) ToAPI ¶
func (c InternalClusterMember) ToAPI() (*internalTypes.ClusterMember, error)
ToAPI returns the api struct for a ClusterMember database entity. The cluster member's status will be reported as unreachable by default.
type InternalClusterMemberFilter ¶
InternalClusterMemberFilter is used for filtering queries using generated methods.
type InternalTokenRecord ¶
InternalTokenRecord is the database representation of a join token record.
func GetInternalTokenRecord ¶
func GetInternalTokenRecord(ctx context.Context, tx *sql.Tx, secret string) (*InternalTokenRecord, error)
GetInternalTokenRecord returns the internal_token_record with the given key. generator: internal_token_record GetOne
func GetInternalTokenRecords ¶
func GetInternalTokenRecords(ctx context.Context, tx *sql.Tx, filters ...InternalTokenRecordFilter) ([]InternalTokenRecord, error)
GetInternalTokenRecords returns all available internal_token_records. generator: internal_token_record GetMany
func (*InternalTokenRecord) ToAPI ¶
func (t *InternalTokenRecord) ToAPI(clusterCert *x509.Certificate, joinAddresses []types.AddrPort) (*internalTypes.TokenRecord, error)
ToAPI converts the InternalTokenRecord to a full token and returns an API compatible struct.
type InternalTokenRecordFilter ¶
InternalTokenRecordFilter is the filter struct for filtering results from generated methods.