64 lines
2.2 KiB
Go
64 lines
2.2 KiB
Go
package database
|
|
|
|
import "time"
|
|
|
|
// Commit stores all the necessary information for a commit
|
|
type Commit struct {
|
|
CommitHash string // The hash of the commit (generated by hashing commit author name, time, the previous commit, and more? TODO: Not sure what else)
|
|
TrackedFiles []File // All of the tracked files for this commit
|
|
Date string
|
|
Version string //User can tag a commit with a version number
|
|
|
|
}
|
|
|
|
// CommitMeta stores the meta information about the commit
|
|
type CommitMeta struct {
|
|
Tag string
|
|
Flavour string
|
|
PersistLogs bool
|
|
Production bool
|
|
Virtual bool
|
|
}
|
|
|
|
// File represents a tracked file
|
|
type File struct {
|
|
ID int `storm:"id,increment"`
|
|
Path string `storm:"index"`
|
|
Name string
|
|
BkpLocation string //TODO: Needed?
|
|
CurrentBase string
|
|
CurrentHash [16]byte `storm:"index,unique"`
|
|
CreatedAt time.Time
|
|
Unique string
|
|
Version float64
|
|
NoCompress bool // Whether or not to compress this file
|
|
}
|
|
|
|
type FileIndex struct {
|
|
ID int `storm:"id,increment"`
|
|
FileID int `storm:"index"`
|
|
FileHash [16]byte `storm:"index,unique"`
|
|
Index []byte
|
|
Length int64
|
|
}
|
|
|
|
// DiffObject store the information for each diff that is made
|
|
type DiffObject struct {
|
|
ID int `storm:"id,increment"`
|
|
Subject string `storm:"index"`
|
|
Object string `storm:"index"`
|
|
SubjectHash [16]byte `storm:"index"`
|
|
ObjectHash [16]byte `storm:"index"`
|
|
Watching string //name of the file being watched
|
|
DiffPath string //path of the diff/patch
|
|
//Label string //store a comment if the user wants to (user written)
|
|
//Screenshot string //path to the screen shot when the diff was made
|
|
Fs bool //whether it was written to the directly
|
|
Description string //record of forward or backward (just a quick helper)
|
|
E error //a record of the error when it was created. Maybe able to optimize out later
|
|
//Diff *[]byte //the diff itself (incase we want to store in memory) - unused as of now
|
|
DiffSize int64 //the size of the diff in bytes
|
|
StartTime time.Time //when was the diff created (can take a while to create)
|
|
Message string //any message we want to store against the diff while its created
|
|
}
|