<commit_before>package modelhelper

import (
	"koding/db/models"

	"labix.org/v2/mgo"
)

func GetTagById(id string) (*models.Tag, error) {
	tag := new(models.Tag)

	return tag, Mongo.One("jTags", id, tag)
}

func UpdateTag(t *models.Tag) error {
	query := func(c *mgo.Collection) error {
		return c.UpdateId(t.Id, t)
	}

	return Mongo.Run("jTags", query)
}

func GetSomeTags(s Selector, o Options) ([]models.Tag, error) {
	tags := make([]models.Tag, 0)
	query := func(c *mgo.Collection) error {
		q := c.Find(s)
		decorateQuery(q, o)
		return q.All(&tags)
	}
	return tags, Mongo.Run("jTags", query)
}

func CheckTagExistence(id string) (bool, error) {
	var exists bool
	query := checkExistence(id, &exists)
	return exists, Mongo.Run("jTags", query)
}<commit_msg>Migration: GetTag is added for fetching single tag<commit_after>package modelhelper

import (
	"koding/db/models"

	"labix.org/v2/mgo"
)

func GetTagById(id string) (*models.Tag, error) {
	tag := new(models.Tag)

	return tag, Mongo.One("jTags", id, tag)
}

func UpdateTag(t *models.Tag) error {
	query := func(c *mgo.Collection) error {
		return c.UpdateId(t.Id, t)
	}

	return Mongo.Run("jTags", query)
}

func GetSomeTags(s Selector, o Options) ([]models.Tag, error) {
	tags := make([]models.Tag, 0)
	query := func(c *mgo.Collection) error {
		q := c.Find(s)
		decorateQuery(q, o)
		return q.All(&tags)
	}
	return tags, Mongo.Run("jTags", query)
}

func CheckTagExistence(id string) (bool, error) {
	var exists bool
	query := checkExistence(id, &exists)
	return exists, Mongo.Run("jTags", query)
}

func GetTag(s Selector, o Options) (*models.Tag, error) {
	tag := new(models.Tag)

	query := func(c *mgo.Collection) error {
		q := c.Find(s)
		decorateQuery(q, o)
		return q.One(tag)
	}

	return tag, Mongo.Run("jTags", query)
}
{'fraction_non_alphanumeric': 0.1652707984366276, 'fraction_numerical': 0.002233389168062535, 'mean_word_length': 4.349253731343284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2756717', 'n_tokens_mistral': 727, 'n_tokens_neox': 696, 'n_words': 170}