Skip to content

Commit 4438eff

Browse files
Modified function name
1 parent db348c0 commit 4438eff

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

entity-book.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ func (book *Book) Id() string {
195195
return book.Onix.RecordReference
196196
}
197197

198-
//Valid returns true if Book is valid data
199-
func (book *Book) Valid() bool {
198+
//IsValid returns true if Book is valid data
199+
func (book *Book) IsValid() bool {
200200
return len(book.Id()) > 0
201201
}
202202

203203
//ISBN returns ISBN code
204204
func (book *Book) ISBN() string {
205-
if !book.Valid() {
205+
if !book.IsValid() {
206206
return ""
207207
}
208208
if len(book.Onix.ProductIdentifier.IDValue) > 0 {
@@ -216,7 +216,7 @@ func (book *Book) ISBN() string {
216216

217217
//Title returns string of Book Title
218218
func (book *Book) Title() string {
219-
if !book.Valid() {
219+
if !book.IsValid() {
220220
return ""
221221
}
222222
title := ""
@@ -231,7 +231,7 @@ func (book *Book) Title() string {
231231

232232
//SubTitle returns string of sub-title
233233
func (book *Book) SubTitle() string {
234-
if !book.Valid() {
234+
if !book.IsValid() {
235235
return ""
236236
}
237237
//TODO: Subtitle
@@ -240,7 +240,7 @@ func (book *Book) SubTitle() string {
240240

241241
//SeriesTitle returns string of series title
242242
func (book *Book) SeriesTitle() string {
243-
if !book.Valid() {
243+
if !book.IsValid() {
244244
return ""
245245
}
246246
if book.Onix.DescriptiveDetail.Collection.TitleDetail != nil {
@@ -255,7 +255,7 @@ func (book *Book) SeriesTitle() string {
255255

256256
//Label returns string of book label
257257
func (book *Book) Label() string {
258-
if !book.Valid() {
258+
if !book.IsValid() {
259259
return ""
260260
}
261261
if book.Onix.DescriptiveDetail.Collection.TitleDetail != nil {
@@ -270,7 +270,7 @@ func (book *Book) Label() string {
270270

271271
//ImageURL returns string of book cover image URL
272272
func (book *Book) ImageURL() string {
273-
if !book.Valid() {
273+
if !book.IsValid() {
274274
return ""
275275
}
276276
if book.Onix.CollateralDetail != nil {
@@ -290,7 +290,7 @@ func (book *Book) ImageURL() string {
290290
//Authors returns strings of Contributors
291291
func (book *Book) Authors() []string {
292292
authors := []string{}
293-
if !book.Valid() {
293+
if !book.IsValid() {
294294
return authors
295295
}
296296
for _, elm := range book.Onix.DescriptiveDetail.Contributor {
@@ -306,7 +306,7 @@ func (book *Book) Authors() []string {
306306

307307
//Publisher returns strings of Publisher
308308
func (book *Book) Publisher() string {
309-
if !book.Valid() {
309+
if !book.IsValid() {
310310
return ""
311311
}
312312
pub := book.Onix.PublishingDetail.Imprint.ImprintName
@@ -321,7 +321,7 @@ func (book *Book) Publisher() string {
321321

322322
//PublicationDate returns Date of Publication
323323
func (book *Book) PublicationDate() Date {
324-
if !book.Valid() {
324+
if !book.IsValid() {
325325
return NewDate(time.Time{})
326326
}
327327
for _, pubdate := range book.Onix.PublishingDetail.PublishingDate {
@@ -337,7 +337,7 @@ func (book *Book) PublicationDate() Date {
337337

338338
//Description returns strings of book description or table of content
339339
func (book *Book) Description() string {
340-
if !book.Valid() {
340+
if !book.IsValid() {
341341
return ""
342342
}
343343
desc := ""

entity-book_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ func TestBooks(t *testing.T) {
127127
continue
128128
}
129129
for i, bk := range bks {
130-
if bk.Valid() != tc.valid[i] {
131-
t.Errorf("Book[%d] is %v, want %v", i, bk.Valid(), tc.valid[i])
130+
if bk.IsValid() != tc.valid[i] {
131+
t.Errorf("Book[%d] is %v, want %v", i, bk.IsValid(), tc.valid[i])
132132
continue
133133
}
134134
if bk.Id() != tc.ids[i] {

0 commit comments

Comments
 (0)