sync

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateSyncTokensTableQuery is the SQL query to create the sync_tokens table
	CreateSyncTokensTableQuery = `
CREATE TABLE IF NOT EXISTS sync_tokens (id INTEGER PRIMARY KEY AUTOINCREMENT, updated_at DATETIME NOT NULL);
`
)

Variables

View Source
var (
	// UpdateLastSyncTokensUpdatedAtQuery is the SQL query to insert a new sync tokens record
	UpdateLastSyncTokensUpdatedAtQuery = `
INSERT INTO sync_tokens (updated_at) VALUES (?);
`

	// GetLastSyncTokensUpdatedAtQuery is the SQL query to get the last sync tokens record
	GetLastSyncTokensUpdatedAtQuery = `
SELECT updated_at FROM sync_tokens ORDER BY updated_at DESC LIMIT 1;
`
)

Functions

This section is empty.

Types

type Service added in v0.7.3

type Service struct {
	godatabasessql.Service
	// contains filtered or unexported fields
}

Service is the default implementation of the Service interface

func NewService added in v0.7.3

func NewService(
	service godatabasessql.Service,
	logger *slog.Logger,
) (*Service, error)

NewService creates a new Service

Parameters:

  • service: the SQL connection service
  • logger: the logger (optional, can be nil)

Returns:

  • *Service: the Service instance
  • error: an error if the data source or driver name is empty

func (*Service) Connect added in v0.7.3

func (d *Service) Connect(ctx context.Context) error

Connect opens the database connection

Parameters:

  • ctx: the context

Returns:

  • error: an error if the connection could not be opened

func (*Service) GetLastSyncTokensUpdatedAt added in v0.7.3

func (d *Service) GetLastSyncTokensUpdatedAt(ctx context.Context) (
	time.Time,
	error,
)

GetLastSyncTokensUpdatedAt gets the last sync tokens updated at timestamp

Parameters:

  • ctx: the context

Returns:

  • time.Time: the last sync tokens updated at timestamp
  • error: an error if the timestamp could not be retrieved

func (*Service) UpdateLastSyncTokensUpdateAt added in v0.7.3

func (d *Service) UpdateLastSyncTokensUpdateAt(
	ctx context.Context,
	updatedAt time.Time,
) error

UpdateLastSyncTokensUpdateAt updates the last sync tokens updated at timestamp

Parameters:

  • ctx: the context
  • updatedAt: the new timestamp

Returns:

  • error: an error if the timestamp could not be updated

Jump to

Keyboard shortcuts

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