split the vendor and the package
This commit is contained in:
12
packages.go
12
packages.go
@@ -19,7 +19,8 @@ import (
|
||||
)
|
||||
|
||||
type jsonStruct struct {
|
||||
Identifier string
|
||||
Vendor string
|
||||
Package string
|
||||
Version string
|
||||
Type string
|
||||
Location string
|
||||
@@ -231,7 +232,8 @@ func moveToNewLocationAndName(data map[string]string) string {
|
||||
func createObject(object map[string]string) jsonStruct {
|
||||
if detectProblems(object) {
|
||||
prop := jsonStruct{
|
||||
Identifier: getVendor(object) + "." + getProgram(object),
|
||||
Vendor: getVendor(object) ,
|
||||
Package: getProgram(object),
|
||||
Version: getVersion(object),
|
||||
Type: getInstallerType(object),
|
||||
}
|
||||
@@ -253,15 +255,15 @@ func newJson(object jsonStruct) {
|
||||
if err != nil {
|
||||
slog.Error(err.Error())
|
||||
}
|
||||
sqldb.Exec("INSERT OR IGNORE INTO newapps(identifier, version, type, location, checksum, url) values (?,?,?,?,?,?)", object.Identifier, object.Version, object.Type, object.Location, object.Checksum, object.Url)
|
||||
sqldb.Exec("INSERT OR IGNORE INTO newapps(vendor, package, version, type, location, checksum, url) values (?,?,?,?,?,?,?)", object.Vendor, object.Package, object.Version, object.Type, object.Location, object.Checksum, object.Url)
|
||||
|
||||
}
|
||||
func getJson(sqldb *sql.DB) http.Handler {
|
||||
return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
quer := generateSQL("newapps", []string{"identifier", "version", "type", "location", "checksum", "url"}) + " ORDER BY ROWID DESC LIMIT 1"
|
||||
quer := generateSQL("newapps", []string{"vendor", "package", "version", "type", "location", "checksum", "url"}) + " ORDER BY ROWID DESC LIMIT 1"
|
||||
data := sqldb.QueryRow(quer)
|
||||
jsonelement := jsonStruct{}
|
||||
err := data.Scan(&jsonelement.Identifier, &jsonelement.Version, &jsonelement.Type, &jsonelement.Location, &jsonelement.Checksum, &jsonelement.Url)
|
||||
err := data.Scan(&jsonelement.Vendor, &jsonelement.Package, &jsonelement.Version, &jsonelement.Type, &jsonelement.Location, &jsonelement.Checksum, &jsonelement.Url)
|
||||
if err != nil {
|
||||
slog.Error(err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user