[add] initial commit
This commit is contained in:
31
main.go
Normal file
31
main.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gelvin/app/models"
|
||||
"gelvin/config"
|
||||
"gorm.io/gorm"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
address := "0.0.0.0:8081"
|
||||
if len(os.Args) > 1 {
|
||||
address = os.Args[1]
|
||||
}
|
||||
config := config.Configure()
|
||||
config.App().OpenDB()
|
||||
defer config.App().CloseDB()
|
||||
fmt.Println("Migration:", models.Migrate(config.App()))
|
||||
config.Model().AddSensor(models.Sensor{
|
||||
ID: 0,
|
||||
CreatedAt: time.Time{},
|
||||
UpdatedAt: time.Time{},
|
||||
DeletedAt: gorm.DeletedAt{},
|
||||
Name: "asd",
|
||||
SensorType: 4,
|
||||
Position: models.Position{},
|
||||
})
|
||||
fmt.Println(config.App().Run(address))
|
||||
}
|
||||
Reference in New Issue
Block a user