MCPcopy Create free account
hub / github.com/gogs/gogs / GetOrgByName

Function GetOrgByName

internal/database/org.go:173–188  ·  view source on GitHub ↗

GetOrgByName returns organization by given name.

(name string)

Source from the content-addressed store, hash-verified

171
172// GetOrgByName returns organization by given name.
173func GetOrgByName(name string) (*User, error) {
174 if name == "" {
175 return nil, ErrOrgNotExist
176 }
177 u := &User{
178 LowerName: strings.ToLower(name),
179 Type: UserTypeOrganization,
180 }
181 has, err := x.Get(u)
182 if err != nil {
183 return nil, err
184 } else if !has {
185 return nil, ErrOrgNotExist
186 }
187 return u, nil
188}
189
190// CountOrganizations returns number of organizations.
191func CountOrganizations() int64 {

Callers 2

EditFunction · 0.92
CreateOrgRepoFunction · 0.92

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected