本文整理汇总了Golang中github.com/att-innovate/boomer/dbconnector.Cpe类的典型用法代码示例。如果您正苦于以下问题:Golang Cpe类的具体用法?Golang Cpe怎么用?Golang Cpe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cpe类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: DeleteTopo
func DeleteTopo(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var topo dbconn.Topo
var cpe dbconn.Cpe
var err error
topo.Id, err = strconv.ParseInt(vars["Topoid"], 10, 64)
// Need to clear the TopoID on the associated CPE - set it to Topoid = 0
if err = topo.Get(); err != nil {
http.Error(w, err.Error(), 500)
return
}
cpe.Id = topo.Cpeid
cpe.Topoid = 0
if err = cpe.Update(); err != nil {
http.Error(w, err.Error(), 500)
return
}
//Delete the topo from Topos Table
if err = topo.Delete(); err != nil {
http.Error(w, err.Error(), 500)
return
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:28,代码来源:topo_handler.go
示例2: UpdateCpe
func UpdateCpe(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
cid, _ := strconv.ParseInt(vars["Cpeid"], 10, 64)
var cpe dbconn.Cpe
if err := cpe.Parse(w, r); err != nil {
http.Error(w, err.Error(), 500)
return
}
if cid != cpe.Id {
err := fmt.Errorf("Cpeid mismatch")
http.Error(w, err.Error(), 500)
return
}
if err := cpe.Update(); err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusCreated)
if err := json.NewEncoder(w).Encode(cpe); err != nil {
panic(err)
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:28,代码来源:cpe_handler.go
示例3: GetCpeTopo
func GetCpeTopo(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var cpe dbconn.Cpe
var topo dbconn.Topo
var err error
cpe.Id, err = strconv.ParseInt(vars["Cpeid"], 10, 64)
if err = cpe.Get(); err != nil {
http.Error(w, err.Error(), 500)
return
}
topo.Id = cpe.Topoid
if err = topo.Get(); err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusCreated)
if err := json.NewEncoder(w).Encode(topo); err != nil {
panic(err)
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:28,代码来源:cpe_handler.go
示例4: DeleteCpe
func DeleteCpe(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var cpe dbconn.Cpe
var err error
cpe.Id, err = strconv.ParseInt(vars["Cpeid"], 10, 64)
err = cpe.Delete()
if err != nil {
return
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:12,代码来源:cpe_handler.go
示例5: AddTopo
func AddTopo(w http.ResponseWriter, r *http.Request) {
var topo dbconn.Topo
var cpe dbconn.Cpe
if err := topo.Parse(w, r); err != nil {
http.Error(w, err.Error(), 500)
return
}
if err := topo.Add(); err != nil {
http.Error(w, err.Error(), 500)
return
}
cpe.Id = topo.Cpeid
if err := cpe.Get(); err != nil {
http.Error(w, err.Error(), 500)
return
}
cpe.Topoid = topo.Id
if err := cpe.Update(); err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusCreated)
if err := json.NewEncoder(w).Encode(topo); err != nil {
panic(err)
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:33,代码来源:topo_handler.go
示例6: AddCpe
func AddCpe(w http.ResponseWriter, r *http.Request) {
var cpe dbconn.Cpe
if err := cpe.Parse(w, r); err != nil {
http.Error(w, err.Error(), 500)
return
}
if err := cpe.Add(); err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusCreated)
if err := json.NewEncoder(w).Encode(cpe); err != nil {
panic(err)
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:20,代码来源:cpe_handler.go
示例7: GetUserCpe
func GetUserCpe(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
var cpes []dbconn.Cpe
var cpe dbconn.Cpe
var err error
cpe.Userid, err = strconv.ParseInt(vars["Userid"], 10, 64)
cpes, err = cpe.Gets()
if err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusCreated)
if err := json.NewEncoder(w).Encode(cpes); err != nil {
panic(err)
}
}
开发者ID:smgemelos,项目名称:boomer,代码行数:22,代码来源:user_handler.go
注:本文中的github.com/att-innovate/boomer/dbconnector.Cpe类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论