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


Golang logq.LogPutqueue函数代码示例

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


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

示例1: delTag

func delTag(reponame, itemname, tagname string) (int, error) {
	log.Println("TODO  delete tag from db")
	sqlrpdmid := fmt.Sprintf(`SELECT RPDMID FROM DH_DP_RPDM_MAP WHERE REPOSITORY='%s' AND DATAITEM='%s' AND STATUS='A';`, reponame, itemname)
	var rpdmId int
	row, err := g_ds.QueryRow(sqlrpdmid)
	if err != nil {
		l := log.Error("select rpdmid from DH_DP_RPDM_MAP error:", err)
		logq.LogPutqueue(l)
		return 0, err
	}
	row.Scan(&rpdmId)

	sql := fmt.Sprintf(`SELECT TAGID FROM DH_RPDM_TAG_MAP WHERE STATUS='A' AND TAGNAME='%s' AND RPDMID=%d`, tagname, rpdmId)
	var tagid int
	row, err = g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error("select tagid from DH_DP_RPDM_MAP error:", err)
		logq.LogPutqueue(l)
		return 0, err
	}
	row.Scan(&tagid)

	sql = fmt.Sprintf(`UPDATE DH_RPDM_TAG_MAP SET STATUS='N' WHERE TAGNAME='%s' AND RPDMID=%d`, tagname, rpdmId)
	_, err = g_ds.Update(sql)
	if err != nil {
		l := log.Error("delete tag from DH_RPDM_TAG_MAP error:", err)
		logq.LogPutqueue(l)
		return 0, err
	}

	return tagid, nil
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:32,代码来源:common.go

示例2: saveDaemonID

func saveDaemonID(id string) {
	log.Println("TODO save daemonid to db when srv returns code 0.")
	count := `SELECT COUNT(*) FROM DH_DAEMON;`
	row, err := g_ds.QueryRow(count)
	if err != nil {
		l := log.Error(count, "error.", err)
		logq.LogPutqueue(l)
	}
	var c int
	row.Scan(&c)
	if c > 0 {
		Update := fmt.Sprintf(`UPDATE DH_DAEMON SET DAEMONID='%s';`, id)
		log.Debug(Update)
		if _, e := g_ds.Update(Update); e != nil {
			l := log.Error(Update, "error.", e)
			logq.LogPutqueue(l)
		}
	} else {
		Insert := fmt.Sprintf(`INSERT INTO DH_DAEMON (DAEMONID) VALUES ('%s');`, id)
		log.Debug(c, Insert)
		if _, e := g_ds.Insert(Insert); e != nil {
			l := log.Error(Insert, "error.", e)
			logq.LogPutqueue(l)
		}
	}
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:26,代码来源:common.go

示例3: delTagsForDelItem

func delTagsForDelItem(reponame, itemname string) error {
	log.Println("Begin to remove tags for remove item from db")
	sqlrpdmid := fmt.Sprintf(`SELECT RPDMID FROM DH_DP_RPDM_MAP WHERE REPOSITORY='%s' AND DATAITEM='%s' AND STATUS='A';`, reponame, itemname)

	row, err := g_ds.QueryRow(sqlrpdmid)
	if err != nil {
		l := log.Error("select rpdmid from DH_DP_RPDM_MAP error:", err)
		logq.LogPutqueue(l)
		return err
	}
	var rpdmId int
	row.Scan(&rpdmId)
	if rpdmId == 0 {
		log.Debug(reponame, itemname, "not exist.")
		return nil
	}
	sqldeltag := fmt.Sprintf(`UPDATE DH_RPDM_TAG_MAP SET STATUS='N' WHERE RPDMID=%d`, rpdmId)
	_, err = g_ds.Update(sqldeltag)
	log.Info("sqldeltag", sqldeltag)
	if err != nil {
		l := log.Error("delete tag error:", err)
		logq.LogPutqueue(l)
		return err
	}

	return nil
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:27,代码来源:common.go

示例4: getBatchDelTagsName

func getBatchDelTagsName(reponame, itemname, tagname string) ([]string, error) {
	log.Println("Batch delete tags from db")
	sqlrpdmid := fmt.Sprintf(`SELECT RPDMID FROM DH_DP_RPDM_MAP WHERE REPOSITORY='%s' AND DATAITEM='%s' AND STATUS='A';`, reponame, itemname)
	var rpdmId int

	row, err := g_ds.QueryRow(sqlrpdmid)
	if err != nil {
		l := log.Error("select rpdmid from DH_DP_RPDM_MAP error:", err)
		logq.LogPutqueue(l)
		return nil, err
	}
	row.Scan(&rpdmId)

	tagname = strings.Replace(tagname, "*", "%", -1)
	log.Println(tagname)
	sql := fmt.Sprintf(`SELECT TAGNAME FROM DH_RPDM_TAG_MAP WHERE TAGNAME LIKE '%s' AND RPDMID=%d AND STATUS='A';`, tagname, rpdmId)
	//var tagnames []string
	tagsname := make([]string, 0)
	rows, err := g_ds.QueryRows(sql)
	if err != nil {
		l := log.Error("batch delete tag from DH_RPDM_TAG_MAP error:", err)
		logq.LogPutqueue(l)
		return nil, err
	}
	for rows.Next() {
		rows.Scan(&tagname)
		tagsname = append(tagsname, tagname)
	}
	log.Println(tagsname)
	/*if len(tagsname) == 0 {
		return nil, errors.New("没有匹配的tag")
	}*/
	return tagsname, nil

}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:35,代码来源:common.go

示例5: saveEntryPoint

func saveEntryPoint(ep string) {
	log.Println("TODO save ep to db")
	count := `SELECT COUNT(*) FROM DH_DAEMON;`
	row, err := g_ds.QueryRow(count)
	if err != nil {
		l := log.Error(count, "error.", err)
		logq.LogPutqueue(l)
	}
	var c int
	row.Scan(&c)
	if c > 0 {
		Update := fmt.Sprintf(`UPDATE DH_DAEMON SET ENTRYPOINT='%s';`, ep)
		log.Debug(Update)
		if _, e := g_ds.Update(Update); e != nil {
			l := log.Error(Update, "error.", e)
			logq.LogPutqueue(l)
		}
	} else {
		Insert := fmt.Sprintf(`INSERT INTO DH_DAEMON (ENTRYPOINT) VALUES ('%s');`, ep)
		log.Debug(c, Insert)
		if _, e := g_ds.Insert(Insert); e != nil {
			l := log.Error(Insert, "error.", e)
			logq.LogPutqueue(l)
		}
	}
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:26,代码来源:common.go

示例6: GetRepoInfo

func GetRepoInfo(dpName, status string, offset int64, limit int) ([]ds.RepoInfo, error) {

	if status == "published" {
		status = "Y"
	} else {
		status = "N"
	}

	sql := fmt.Sprintf(`SELECT DPID FROM DH_DP WHERE DPNAME = '%s' AND STATUS = 'A';`, dpName)
	row, err := g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return nil, err
	}

	var dpid int
	row.Scan(&dpid)
	if dpid == 0 {
		return nil, errors.New(fmt.Sprintf("No datapool named %s.", dpName))
	}

	sql = fmt.Sprintf(`SELECT DISTINCT REPOSITORY 
		FROM DH_DP_RPDM_MAP 
		WHERE DPID = %d AND PUBLISH = '%s' AND STATUS = 'A'
		ORDER BY RPDMID  
		LIMIT %v OFFSET %v;`, dpid, status, limit, offset)
	rows, err := g_ds.QueryRows(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return nil, err
	}

	var repository string
	var itemCount int
	repoinfo := ds.RepoInfo{}
	repoInfos := make([]ds.RepoInfo, 0)
	for rows.Next() {
		rows.Scan(&repository)

		repoinfo.RepositoryName = repository
		sql = fmt.Sprintf(`SELECT COUNT(*) FROM DH_DP_RPDM_MAP WHERE REPOSITORY = '%s' AND PUBLISH = '%s' AND STATUS = 'A';`, repository, status)
		row, err := g_ds.QueryRow(sql)
		if err != nil {
			l := log.Error(err)
			logq.LogPutqueue(l)
			return nil, err
		}

		row.Scan(&itemCount)
		repoinfo.ItemCount = itemCount

		repoInfos = append(repoInfos, repoinfo)
	}

	return repoInfos, err
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:58,代码来源:common.go

示例7: GetPulledTagsOfItemInfo

func GetPulledTagsOfItemInfo(dpname, repo, item string, offset int64, limit int) ([]ds.PulledTagsOfItem, error) {

	pulledTagOfItem := ds.PulledTagsOfItem{}
	pulledTagsOfItem := make([]ds.PulledTagsOfItem, 0)

	sql := fmt.Sprintf(`SELECT DPID FROM DH_DP WHERE DPNAME = '%s' AND STATUS = 'A';`, dpname)
	row, err := g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return nil, err
	}

	var dpid int
	row.Scan(&dpid)
	if dpid == 0 {
		return pulledTagsOfItem, errors.New(fmt.Sprintf("No datapool named %s.", dpname))
	}

	sql = fmt.Sprintf(`SELECT RPDMID FROM DH_DP_RPDM_MAP
				WHERE REPOSITORY  = '%s'
				AND DATAITEM = '%s'
				AND DPID = %d
				AND PUBLISH = 'N'
				AND STATUS = 'A';`, repo, item, dpid)

	row, err = g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return nil, err
	}

	var rpdmid int
	row.Scan(&rpdmid)

	sql = fmt.Sprintf(`SELECT TAGNAME, CREATE_TIME, COMMENT FROM DH_RPDM_TAG_MAP WHERE RPDMID = %d AND STATUS = 'A' LIMIT %v OFFSET %v;`, rpdmid, limit, offset)
	rows, err := g_ds.QueryRows(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return nil, err
	}

	for rows.Next() {
		rows.Scan(&pulledTagOfItem.TagName, &pulledTagOfItem.DownloadTime, &pulledTagOfItem.Content)
		pulledTagsOfItem = append(pulledTagsOfItem, pulledTagOfItem)
	}

	return pulledTagsOfItem, err
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:51,代码来源:common.go

示例8: dbinit

func dbinit() {

	DB_TYPE := os.Getenv("DB_TYPE")
	if strings.ToUpper(DB_TYPE) == "MYSQL" {
		for i := 0; i < 3; i++ {
			connectMysql()
			if g_ds.Db == nil {
				select {
				case <-time.After(time.Second * 5):
					continue
				}
			} else {
				break
			}
		}
		if g_ds.Db == nil {
			return
		}
	} else {
		log.Println("connect to db sqlite3")
		db, err := sql.Open("sqlite3", g_dbfile)
		//defer db.Close()
		chk(err)
		g_ds.Db = db
		g_ds.DbType = "sqlite"
	}

	var RetDhRpdmTagMap string
	row, err := g_ds.QueryRow(ds.SQLIsExistRpdmTagMap)
	if err != nil {
		l := log.Error("Get Dh_Rpdm_Tag_Map error!")
		logq.LogPutqueue(l)
		return
	}
	row.Scan(&RetDhRpdmTagMap)
	if len(RetDhRpdmTagMap) > 1 {
		if false == strings.Contains(RetDhRpdmTagMap, "COMMENT") {
			//	UpdateSql04To05()
			UpdateSql16To17()
		}
	}
	//if err := UpgradeSql07To08(); err != nil {
	//	panic(err)
	//}
	if err := CreateTable(); err != nil {
		l := log.Error("Get CreateTable error!", err)
		logq.LogPutqueue(l)
		panic(err)
	}
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:50,代码来源:daemon.go

示例9: GetLocalfilePath

func GetLocalfilePath() (localfilepath []string) {
	sql := `SELECT DISTINCT DPCONN, ITEMDESC FROM DH_DP A, DH_DP_RPDM_MAP B
							WHERE A.DPID=B.DPID AND A.DPTYPE='file'
									    AND A.STATUS='A'
									    AND B.PUBLISH='Y'
									    AND B.STATUS='A';`
	//dpci = make(map[string] string)

	var conn string
	var desc string
	localfilepath = make([]string, 0)
	rows, err := g_ds.QueryRows(sql)
	if err != nil {
		l := log.Error("QueryRow error:", err)
		logq.LogPutqueue(l)
		return
	} else {
		for rows.Next() {
			rows.Scan(&conn, &desc)
			path := conn + "/" + desc
			localfilepath = append(localfilepath, path)
		}
		return
	}
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:25,代码来源:common.go

示例10: getPulledTagCount

func getPulledTagCount(datapool, repo, item string) (int64, error) {

	sql := fmt.Sprintf(`SELECT COUNT(*)
		FROM DH_RPDM_TAG_MAP
		WHERE RPDMID = (SELECT RPDMID FROM DH_DP_RPDM_MAP
					WHERE REPOSITORY  = '%s'
					AND DATAITEM = '%s'

					AND PUBLISH = 'N'
					AND STATUS = 'A'
					AND DPID = (SELECT DPID FROM DH_DP WHERE DPNAME = '%s' AND STATUS='A'))
		AND STATUS = 'A';`, repo, item, datapool)

	row, err := g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return 0, err
	}

	var count int64
	row.Scan(&count)
	log.Debug("Published repository count:", count)
	return count, err
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:25,代码来源:common.go

示例11: getRepoCountByDp

func getRepoCountByDp(datapool, status string) int64 {
	if status == "published" {
		status = "Y"
	} else {
		status = "N"
	}

	sql := fmt.Sprintf(`SELECT COUNT(DISTINCT REPOSITORY) 
		FROM DH_DP_RPDM_MAP 
		WHERE DPID IN
		(SELECT DPID FROM DH_DP WHERE DPNAME = '%s' AND STATUS='A')
		AND PUBLISH= '%s' 
		AND STATUS = 'A';`, datapool, status)

	row, err := g_ds.QueryRow(sql)
	if err != nil {
		l := log.Error(err)
		logq.LogPutqueue(l)
		return 0
	}

	var count int64
	row.Scan(&count)
	log.Debug("Published repository count:", count)
	return count
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:26,代码来源:common.go

示例12: commToServer

func commToServer(method, path string, buffer []byte, w http.ResponseWriter) (body []byte, err error) {
	//Trace()
	s := log.Info("daemon: connecting to", DefaultServer+path)
	logq.LogPutqueue(s)
	req, err := http.NewRequest(strings.ToUpper(method), DefaultServer+path, bytes.NewBuffer(buffer))
	if len(loginAuthStr) > 0 {
		req.Header.Set("Authorization", loginAuthStr)
	}

	//req.Header.Set("User", "admin")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Error(err)
		d := ds.Result{Code: cmd.ErrorServiceUnavailable, Msg: err.Error()}
		body, e := json.Marshal(d)
		if e != nil {
			log.Error(e)
			return body, e
		}
		w.WriteHeader(http.StatusServiceUnavailable)
		w.Write(body)
		return body, err
	}
	defer resp.Body.Close()

	w.WriteHeader(resp.StatusCode)
	body, err = ioutil.ReadAll(resp.Body)
	w.Write(body)
	log.Info(resp.StatusCode, string(body))
	return
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:31,代码来源:handler.go

示例13: ErrLogAndResp

func ErrLogAndResp(c chan int, w http.ResponseWriter, httpcode, errorcode int, err error) (int64, error) {
	l := log.Error(err)
	logq.LogPutqueue(l)
	c <- -1
	HttpNoData(w, http.StatusBadRequest, cmd.ErrorNoRecord, err.Error())
	return 0, err
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:7,代码来源:pull_handler.go

示例14: delEntryPoint

func delEntryPoint() {
	log.Println("TODO remove ep from db.")
	d := `UPDATE DH_DAEMON SET ENTRYPOINT = '';`
	if _, e := g_ds.Update(d); e != nil {
		l := log.Error(d, "error.", e)
		logq.LogPutqueue(l)
	}
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:8,代码来源:common.go

示例15: MoveFromTmp

func MoveFromTmp(src, dest string) (err error) {
	err = os.Rename(src, dest)
	if err != nil {
		l := log.Errorf("Rename %v to %v error. %v", src, dest, err)
		logq.LogPutqueue(l)
	}
	return err
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:8,代码来源:pull_handler.go


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