Ejemplo n.º 1
0
func listProject() {
	db := model.DB()
	var projects []model.Project

	if db.Find(&projects).RecordNotFound() {
		fmt.Println("No project found")
		return
	}

	for _, p := range projects {
		fmt.Println(p.UUID)
	}
}
Ejemplo n.º 2
0
func createProject() {
	db := model.DB()
	project := model.Project{
		UUID: uuid.NewV4().String(),
	}
	db.Create(&project)

	fmt.Printf("Created a new project.\n")
	fmt.Printf("Project UUID - %s\n", project.UUID)
	fmt.Printf("Project Master Key - %s\n", project.MasterKey().Value)
	fmt.Printf("Project Read Key - %s\n", project.ReadKey().Value)
	fmt.Printf("Project Write Key - %s\n", project.WriteKey().Value)
}