// AuthGroupByName retrieves a row from 'public.auth_group' as a AuthGroup.
//
// Generated from index 'auth_group_name_key'.
506719
func AuthGroupByName(db XODB, name string) (*AuthGroup, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, name ` +
		`FROM public.auth_group ` +
		`WHERE name = $1`

	// run query
	XOLog(sqlstr, name)
	ag := AuthGroup{
		_exists: true,
	}

	err = db.QueryRow(sqlstr, name).Scan(&ag.ID, &ag.Name)
	if err != nil {
		return nil, err
	}

	return &ag, nil
}
1289880
func GetGroupIDByName(grpName string) (int, error) {
	f, err := os.Open(GroupFilePath)
	if err != nil {
		return -1, err
	}
	defer f.Close()
	br := bufio.NewReader(f)
	for {
		s, err := br.ReadString('\n')
		if err == io.EOF {
			break
		}
		if err != nil {
			return -1, err
		}
		p := strings.Split(s, ":")
		if len(p) >= 3 && p[0] == grpName {
			return strconv.Atoi(p[2])
		}
	}
	return -1, fmt.Errorf("group %q not found", grpName)
}
272408
func (s *GetAggregateConfigRuleComplianceSummaryOutput) SetGroupByKey(v string) *GetAggregateConfigRuleComplianceSummaryOutput {
	s.GroupByKey = &v
	return s
}
348980
func (s *GetServiceGraphInput) SetGroupName(v string) *GetServiceGraphInput {
	s.GroupName = &v
	return s
}
203966
func (rs Routes) ByName(name string) Route {
	// Since all routes have their name empty by default,
	// we cannot return the first route with an empty name
	if name == "" {
		return nil
	}
	for _, route := range rs {
		if route.Name() == name {
			return route
		}
	}

	return nil
}
125491
func ByName(handlers ...*HandlerName) cfg.Handler {
	nhandler := &byNameHandler{
		handlers: HandlerNames(handlers).ToMap(),
	}
	return nhandler
}
808506
func AuthUserGroupByUserIDGroupID(db XODB, userID int, groupID int) (*AuthUserGroup, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, user_id, group_id ` +
		`FROM auth_user_groups ` +
		`WHERE user_id = ? AND group_id = ?`

	// run query
	XOLog(sqlstr, userID, groupID)
	aug := AuthUserGroup{
		_exists: true,
	}

	err = db.QueryRow(sqlstr, userID, groupID).Scan(&aug.ID, &aug.UserID, &aug.GroupID)
	if err != nil {
		return nil, err
	}

	return &aug, nil
}
943820
func AuthGroupPermissionByGroupIDPermissionID(db XODB, groupID float64, permissionID float64) (*AuthGroupPermission, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, group_id, permission_id ` +
		`FROM django.auth_group_permissions ` +
		`WHERE group_id = :1 AND permission_id = :2`

	// run query
	XOLog(sqlstr, groupID, permissionID)
	agp := AuthGroupPermission{
		_exists: true,
	}

	err = db.QueryRow(sqlstr, groupID, permissionID).Scan(&agp.ID, &agp.GroupID, &agp.PermissionID)
	if err != nil {
		return nil, err
	}

	return &agp, nil
}
1126278
func (s *DBSecurityGroup) SetDBSecurityGroupName(v string) *DBSecurityGroup {
	s.DBSecurityGroupName = &v
	return s
}
73960
func (sl *Slack) FindGroupByName(name string) (*Group, error) {
	return sl.FindGroup(func(group *Group) bool {
		return group.Name == name
	})
}
220022
func (t *Template) GetAWSIAMGroupWithName(name string) (*resources.AWSIAMGroup, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSIAMGroup:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSIAMGroup not found", name)
}
482201
func (s *AggregateComplianceCount) SetGroupName(v string) *AggregateComplianceCount {
	s.GroupName = &v
	return s
}
68061
func (s *AuthorizeCacheSecurityGroupIngressInput) SetCacheSecurityGroupName(v string) *AuthorizeCacheSecurityGroupIngressInput {
	s.CacheSecurityGroupName = &v
	return s
}
1122388
func (s *StateStore) ACLPolicyByName(ws memdb.WatchSet, name string) (*structs.ACLPolicy, error) {
	txn := s.db.Txn(false)

	watchCh, existing, err := txn.FirstWatch("acl_policy", "id", name)
	if err != nil {
		return nil, fmt.Errorf("acl policy lookup failed: %v", err)
	}
	ws.Add(watchCh)

	if existing != nil {
		return existing.(*structs.ACLPolicy), nil
	}
	return nil, nil
}
777502
func AuthGroupByID(db XODB, id int) (*AuthGroup, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`id, name ` +
		`FROM django.auth_group ` +
		`WHERE id = ?`

	// run query
	XOLog(sqlstr, id)
	ag := AuthGroup{
		_exists: true,
	}

	err = db.QueryRow(sqlstr, id).Scan(&ag.ID, &ag.Name)
	if err != nil {
		return nil, err
	}

	return &ag, nil
}
984902
func (t *Template) GetAWSElastiCacheSecurityGroupWithName(name string) (*resources.AWSElastiCacheSecurityGroup, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSElastiCacheSecurityGroup:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSElastiCacheSecurityGroup not found", name)
}
169700
func (t *TeamsClient) GetByName(ctx context.Context, orgID *identity.ID, name string) ([]envelope.Team, error) {
	return t.List(ctx, orgID, name, primitive.AnyTeamType)
}