当前位置: 首页>>代码示例>>Golang>>正文


Golang model.Project类代码示例

本文整理汇总了Golang中github.com/angdev/chocolat/model.Project的典型用法代码示例。如果您正苦于以下问题:Golang Project类的具体用法?Golang Project怎么用?Golang Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Project类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: createMultipleEvents

func createMultipleEvents(p *model.Project, params CreateMultipleEventParams) (interface{}, error) {
	r := repo.NewRepository(p.RepoName())
	defer r.Close()

	result := make(map[string][]RawResult)
	for event, docs := range params {
		result[event] = insertEvents(r, event, docs...)
	}

	return result, nil
}
开发者ID:angdev,项目名称:chocolat,代码行数:11,代码来源:event_service.go

示例2: createEvent

func createEvent(p *model.Project, collName string, params CreateSingleEventParams) (interface{}, error) {
	r := repo.NewRepository(p.RepoName())
	defer r.Close()

	result := insertEvents(r, collName, params)
	if result[0]["success"] == true {
		return RawResult{"created": true}, nil
	} else {
		return RawResult{"created": false}, nil
	}
}
开发者ID:angdev,项目名称:chocolat,代码行数:11,代码来源:event_service.go

示例3: inspectCollection

func inspectCollection(p *model.Project, name string) (interface{}, error) {
	r := repo.NewRepository(p.RepoName())
	defer r.Close()

	c := r.C(name)
	var result query.RawExpr

	if err := c.Find(nil).One(&result); err != nil {
		return nil, err
	} else {
		return inspectResult{
			Name:       name,
			Properties: docToSchema(&result),
			Url:        fmt.Sprintf("/3.0/projects/<PROJECT_ID>/events/%s", name),
		}, nil
	}
}
开发者ID:angdev,项目名称:chocolat,代码行数:17,代码来源:event_service.go

示例4: inspectAllCollections

func inspectAllCollections(p *model.Project) (interface{}, error) {
	r := repo.NewRepository(p.RepoName())
	defer r.Close()

	collectionNames, err := r.CollectionNames()
	if err != nil {
		return nil, err
	}

	results := []interface{}{}
	for _, name := range collectionNames {
		if singleResult, err := inspectCollection(p, name); err != nil {
			return nil, err
		} else {
			results = append(results, singleResult)
		}
	}

	return results, nil
}
开发者ID:angdev,项目名称:chocolat,代码行数:20,代码来源:event_service.go

示例5: createProject

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)
}
开发者ID:chocolat-team,项目名称:chocolat,代码行数:13,代码来源:cli.go

示例6: boundScope

func boundScope(project *model.Project, authKey string, scopes ...model.ApiScope) bool {
	ok := false

	for _, scope := range scopes {
		switch scope {
		case model.ApiReadKey:
			ok = (project.ReadKey().Value == authKey)
		case model.ApiWriteKey:
			ok = (project.WriteKey().Value == authKey)
		case model.ApiMasterKey:
			ok = (project.MasterKey().Value == authKey)
		}

		if ok {
			return ok
		}
	}

	return ok
}
开发者ID:angdev,项目名称:chocolat,代码行数:20,代码来源:auth.go


注:本文中的github.com/angdev/chocolat/model.Project类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。