mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 02:10:40 +00:00
Better function descriptions
This commit is contained in:
parent
9b5d8bbeda
commit
27c9db1027
1 changed files with 5 additions and 2 deletions
|
@ -37,7 +37,7 @@ func (a ActorID) validate_is_not_empty(str string, field string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Validate collects error strings, concatenates and returns them
|
Validate collects error strings in a slice and returns this
|
||||||
*/
|
*/
|
||||||
func (a ActorID) Validate() []string {
|
func (a ActorID) Validate() []string {
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ func (a ActorID) Validate() []string {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IsValid concatenates the error messages with newlines and returns them if there are any
|
||||||
|
*/
|
||||||
func (a ActorID) IsValid() (bool, error) {
|
func (a ActorID) IsValid() (bool, error) {
|
||||||
if err := a.Validate(); len(err) > 0 {
|
if err := a.Validate(); len(err) > 0 {
|
||||||
errString := strings.Join(err, "\n")
|
errString := strings.Join(err, "\n")
|
||||||
|
@ -88,7 +91,7 @@ func (a ActorID) GetUserId() int {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ActorID) GetNormailzedUri() string {
|
func (a ActorID) GetNormailzedUri() string { // ToDo: Port might be empty
|
||||||
result := fmt.Sprintf("%s://%s:%s/%s/%s", a.schema, a.host, a.port, a.path, a.userId)
|
result := fmt.Sprintf("%s://%s:%s/%s/%s", a.schema, a.host, a.port, a.path, a.userId)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue