up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package item
|
||||
|
||||
// WrittenBookGeneration represents a WrittenBook generation.
|
||||
type WrittenBookGeneration struct {
|
||||
generation
|
||||
}
|
||||
|
||||
type generation uint8
|
||||
|
||||
// OriginalGeneration is the original WrittenBook.
|
||||
func OriginalGeneration() WrittenBookGeneration {
|
||||
return WrittenBookGeneration{0}
|
||||
}
|
||||
|
||||
// CopyGeneration is a copy of the original WrittenBook.
|
||||
func CopyGeneration() WrittenBookGeneration {
|
||||
return WrittenBookGeneration{1}
|
||||
}
|
||||
|
||||
// CopyOfCopyGeneration is a copy of a copy of the original WrittenBook.
|
||||
func CopyOfCopyGeneration() WrittenBookGeneration {
|
||||
return WrittenBookGeneration{2}
|
||||
}
|
||||
|
||||
// Uint8 returns the generation as a uint8.
|
||||
func (g generation) Uint8() uint8 {
|
||||
return uint8(g)
|
||||
}
|
||||
|
||||
// String ...
|
||||
func (g generation) String() string {
|
||||
switch g {
|
||||
case 0:
|
||||
return "original"
|
||||
case 1:
|
||||
return "copy of original"
|
||||
case 2:
|
||||
return "copy of copy"
|
||||
}
|
||||
panic("unknown written book generation")
|
||||
}
|
||||
Reference in New Issue
Block a user