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 DefaultService ¶
type DefaultService struct {
godatabasessql.Service
// contains filtered or unexported fields
}
DefaultService is the default implementation of the Service interface
func NewDefaultService ¶
func NewDefaultService( service godatabasessql.Service, logger *slog.Logger, ) (*DefaultService, error)
NewDefaultService creates a new DefaultService
Parameters:
- service: the SQL connection service
- logger: the logger (optional, can be nil)
Returns:
- *DefaultService: the DefaultService instance
- error: an error if the data source or driver name is empty
func (*DefaultService) Connect ¶
func (d *DefaultService) 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 (*DefaultService) GetLastSyncTokensUpdatedAt ¶
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 (*DefaultService) UpdateLastSyncTokensUpdateAt ¶
func (d *DefaultService) 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
Click to show internal directories.
Click to hide internal directories.