winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

CheckpointDataTable.h (2060B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <winget/SQLiteWrapper.h>
      5 #include <string_view>
      6 #include <vector>
      7 
      8 namespace AppInstaller::Repository::Microsoft::Schema::Checkpoint_V1_0
      9 {
     10     struct CheckpointDataTable
     11     {
     12         // Get the table name.
     13         static std::string_view TableName();
     14 
     15         // Creates the table with named indices.
     16         static void Create(SQLite::Connection& connection);
     17 
     18         // Gets a value indicating whether the table is empty.
     19         static bool IsEmpty(SQLite::Connection& connection);
     20 
     21         // Get all available context data.
     22         static std::vector<int> GetAvailableData(SQLite::Connection& connection, SQLite::rowid_t checkpointId);
     23 
     24         // Adds a context data for a checkpoint. Index is used to represent the item number if the context data has more than one value.
     25         static SQLite::rowid_t AddCheckpointData(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int contextData, std::string_view name, std::string_view value, int index = 1);
     26 
     27         // Gets all fields for a context data.
     28         static std::vector<std::string> GetDataFields(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int type);
     29 
     30         // Gets the context data values by property name from a checkpoint id.
     31         static std::vector<std::string> GetDataValuesByFieldName(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int contextData, std::string_view name);
     32 
     33         // Returns a boolean value indicating whether a field exists for a context data.
     34         static bool HasDataField(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int type, std::string_view name);
     35 
     36         // Removes the context data by checkpoint id.
     37         static void RemoveDataType(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int contextData);
     38 
     39         // Gets a single data value for a context data.
     40         static std::string GetDataValue(SQLite::Connection& connection, SQLite::rowid_t checkpointId, int type);
     41     };
     42 }