Browse Source

Make go docs pretty

Jonathan D. Storm 1 year ago
parent
commit
8414ac3ad8
2 changed files with 35 additions and 32 deletions
  1. 21 19
      README.md
  2. 14 13
      depager.go

+ 21 - 19
README.md

@@ -9,22 +9,22 @@ For the moment, *depager* only supports JSON responses.
 interfaces:
 
 ```go
-/* The `Page` interface must wrap server responses. This
-*  allows pagers to calculate page sizes and iterate over
-*  response aggregates.
-*
-*  The underlying implementation must be a pointer to a
-*  struct containing the desired response fields, all tagged
-*  appropriately. Any fields corresponding to
-*  platform-specific error responses should also be
-*  included.
-*
-*  `Count()` must return the total number of items to be
-*  paged. `Elems()` must return the items from the current
-*  page.
+/*
+The `Page` interface must wrap server responses. This
+allows pagers to calculate page sizes and iterate over
+response aggregates.
+
+The underlying implementation must be a pointer to a
+struct containing the desired response fields, all tagged
+appropriately. Any fields corresponding to
+platform-specific error responses should also be
+included.
 */
 type Page[T any] interface {
+    // Count must return the total number of items to be paged
 	Count() uint64
+
+    // Elems must return the items from the current page
 	Elems() []T
 }
 
@@ -59,9 +59,10 @@ type pagedURI struct {
 }
 
 func (u pagedURI) PageURI(limit, offset uint64) url.URL {
-    /* Different APIs use different conventions. Simply map
-    *  limit and offset to the apposite field names with
-    *  whatever semantics the server expects.
+    /*
+    Different APIs use different conventions. Simply map
+    limit and offset to the apposite field names with
+    whatever semantics the server expects.
     */
 	if limit > MaxPageSize {
 		limit = MaxPageSize
@@ -106,9 +107,10 @@ func makeMyPager[T any](
 	)
 }
 
-/* .
-*  .
-*  .
+/*
+.
+.
+.
 */
 
 type Thing struct {

+ 14 - 13
depager.go

@@ -11,16 +11,16 @@ import (
 	"net/url"
 )
 
-/* The `Page` interface must wrap server responses. This
-*  allows pagers to calculate page sizes and iterate over
-*  response aggregates.
-*
-*  The underlying implementation must be a pointer to a
-*  struct containing the desired response fields, all tagged
-*  appropriately. Any fields corresponding to
-*  platform-specific error responses should also be
-*  included.
- */
+/*
+The `Page` interface must wrap server responses. This
+allows pagers to calculate page sizes and iterate over
+response aggregates.
+
+The underlying implementation must be a pointer to a
+struct containing the desired response fields, all tagged
+appropriately. Any fields corresponding to
+platform-specific error responses should also be included.
+*/
 type Page[T any] interface {
 	// Count must return the total number of items to be paged
 	Count() uint64
@@ -65,9 +65,10 @@ func NewPager[T any](
 	}
 }
 
-/* Retrieve n items in the range [m*n, m*n + n - 1],
-*  inclusive. Keep p pages buffered.
- */
+/*
+Retrieve n items in the range [m*n, m*n + n - 1], inclusive.
+Keep p pages buffered.
+*/
 type pager[T any] struct {
 	client  Client
 	uri     PagedURI