github.com/sqlitebrowser/dio@v0.0.0-20240125125356-b587368e5c6b/cmd/types.go (about)

     1  package cmd
     2  
     3  import "time"
     4  
     5  type branchEntry struct {
     6  	Commit      string `json:"commit"`
     7  	CommitCount int    `json:"commit_count"`
     8  	Description string `json:"description"`
     9  }
    10  
    11  type commitEntry struct {
    12  	AuthorEmail    string    `json:"author_email"`
    13  	AuthorName     string    `json:"author_name"`
    14  	CommitterEmail string    `json:"committer_email"`
    15  	CommitterName  string    `json:"committer_name"`
    16  	ID             string    `json:"id"`
    17  	Message        string    `json:"message"`
    18  	OtherParents   []string  `json:"other_parents"`
    19  	Parent         string    `json:"parent"`
    20  	Timestamp      time.Time `json:"timestamp"`
    21  	Tree           dbTree    `json:"tree"`
    22  }
    23  
    24  type dbListEntry struct {
    25  	CommitID     string `json:"commit_id"`
    26  	DefBranch    string `json:"default_branch"`
    27  	LastModified string `json:"last_modified"`
    28  	Licence      string `json:"licence"`
    29  	Name         string `json:"name"`
    30  	OneLineDesc  string `json:"one_line_description"`
    31  	Public       bool   `json:"public"`
    32  	RepoModified string `json:"repo_modified"`
    33  	SHA256       string `json:"sha256"`
    34  	Size         int64  `json:"size"`
    35  	Type         string `json:"type"`
    36  	URL          string `json:"url"`
    37  }
    38  
    39  type dbTreeEntryType string
    40  
    41  const (
    42  	TREE     dbTreeEntryType = "tree"
    43  	DATABASE                 = "db"
    44  	LICENCE                  = "licence"
    45  )
    46  
    47  type dbTree struct {
    48  	ID      string        `json:"id"`
    49  	Entries []dbTreeEntry `json:"entries"`
    50  }
    51  type dbTreeEntry struct {
    52  	EntryType    dbTreeEntryType `json:"entry_type"`
    53  	LastModified time.Time       `json:"last_modified"`
    54  	LicenceSHA   string          `json:"licence"`
    55  	Name         string          `json:"name"`
    56  	Sha256       string          `json:"sha256"`
    57  	Size         int64           `json:"size"`
    58  }
    59  
    60  type defaultSettings struct {
    61  	SelectedDatabase string `json:"selected_database"`
    62  }
    63  
    64  type licenceEntry struct {
    65  	FileFormat string `json:"file_format"`
    66  	FullName   string `json:"full_name"`
    67  	Order      int    `json:"order"`
    68  	Sha256     string `json:"sha256"`
    69  	URL        string `json:"url"`
    70  }
    71  
    72  type metaData struct {
    73  	ActiveBranch string                  `json:"active_branch"` // The local branch
    74  	Branches     map[string]branchEntry  `json:"branches"`
    75  	Commits      map[string]commitEntry  `json:"commits"`
    76  	DefBranch    string                  `json:"default_branch"` // The default branch *on the server*
    77  	Releases     map[string]releaseEntry `json:"releases"`
    78  	Tags         map[string]tagEntry     `json:"tags"`
    79  }
    80  
    81  type releaseEntry struct {
    82  	Commit        string    `json:"commit"`
    83  	Date          time.Time `json:"date"`
    84  	Description   string    `json:"description"`
    85  	ReleaserEmail string    `json:"email"`
    86  	ReleaserName  string    `json:"name"`
    87  	Size          int64     `json:"size"`
    88  }
    89  
    90  type tagEntry struct {
    91  	Commit      string    `json:"commit"`
    92  	Date        time.Time `json:"date"`
    93  	Description string    `json:"description"`
    94  	TaggerEmail string    `json:"email"`
    95  	TaggerName  string    `json:"name"`
    96  }