forked from nite/go-igdb
u
This commit is contained in:
@@ -2,7 +2,6 @@ package igdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
|
||||
@@ -26,32 +25,3 @@ func (g *Client) GetDateFormats(query string) ([]*pb.DateFormat, error) {
|
||||
|
||||
return data.Dateformats, nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatByID(id uint64) (*pb.DateFormat, error) {
|
||||
query := fmt.Sprintf(`where id=%d; fields *;`, id)
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dateFormats[0], nil
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsByIDs(ids []uint64) ([]*pb.DateFormat, error) {
|
||||
idStrSlice := make([]string, len(ids))
|
||||
for i, id := range ids {
|
||||
idStrSlice[i] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
idStr := fmt.Sprintf(`where id = (%s); fields *;`, strings.Join(idStrSlice, ","))
|
||||
|
||||
return g.GetDateFormats(idStr)
|
||||
}
|
||||
|
||||
func (g *Client) GetDateFormatsLength() (int, error) {
|
||||
query := `fields *; sort id desc; limit 1;`
|
||||
dateFormats, err := g.GetDateFormats(query)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return int(dateFormats[0].Id), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user