@@ -107,7 +107,7 @@ func (s *TokenStore) clean() {
107107 }
108108}
109109
110- // Create create and store the new token information
110+ // Create creates and stores the new token information
111111func (s * TokenStore ) Create (info oauth2.TokenInfo ) error {
112112 buf , err := jsoniter .Marshal (info )
113113 if err != nil {
@@ -143,7 +143,7 @@ func (s *TokenStore) Create(info oauth2.TokenInfo) error {
143143 )
144144}
145145
146- // RemoveByCode delete the authorization code
146+ // RemoveByCode deletes the authorization code
147147func (s * TokenStore ) RemoveByCode (code string ) error {
148148 err := s .adapter .Exec (fmt .Sprintf ("DELETE FROM %s WHERE code = $1" , s .tableName ), code )
149149 if err == ErrNoRows {
@@ -152,7 +152,7 @@ func (s *TokenStore) RemoveByCode(code string) error {
152152 return err
153153}
154154
155- // RemoveByAccess use the access token to delete the token information
155+ // RemoveByAccess uses the access token to delete the token information
156156func (s * TokenStore ) RemoveByAccess (access string ) error {
157157 err := s .adapter .Exec (fmt .Sprintf ("DELETE FROM %s WHERE access = $1" , s .tableName ), access )
158158 if err == ErrNoRows {
@@ -161,7 +161,7 @@ func (s *TokenStore) RemoveByAccess(access string) error {
161161 return err
162162}
163163
164- // RemoveByRefresh use the refresh token to delete the token information
164+ // RemoveByRefresh uses the refresh token to delete the token information
165165func (s * TokenStore ) RemoveByRefresh (refresh string ) error {
166166 err := s .adapter .Exec (fmt .Sprintf ("DELETE FROM %s WHERE refresh = $1" , s .tableName ), refresh )
167167 if err == ErrNoRows {
@@ -176,7 +176,7 @@ func (s *TokenStore) toTokenInfo(data []byte) (oauth2.TokenInfo, error) {
176176 return & tm , err
177177}
178178
179- // GetByCode use the authorization code for token information data
179+ // GetByCode uses the authorization code for token information data
180180func (s * TokenStore ) GetByCode (code string ) (oauth2.TokenInfo , error ) {
181181 if code == "" {
182182 return nil , nil
@@ -186,10 +186,11 @@ func (s *TokenStore) GetByCode(code string) (oauth2.TokenInfo, error) {
186186 if err := s .adapter .SelectOne (& item , fmt .Sprintf ("SELECT * FROM %s WHERE code = $1" , s .tableName ), code ); err != nil {
187187 return nil , err
188188 }
189+
189190 return s .toTokenInfo (item .Data )
190191}
191192
192- // GetByAccess use the access token for token information data
193+ // GetByAccess uses the access token for token information data
193194func (s * TokenStore ) GetByAccess (access string ) (oauth2.TokenInfo , error ) {
194195 if access == "" {
195196 return nil , nil
@@ -199,10 +200,11 @@ func (s *TokenStore) GetByAccess(access string) (oauth2.TokenInfo, error) {
199200 if err := s .adapter .SelectOne (& item , fmt .Sprintf ("SELECT * FROM %s WHERE access = $1" , s .tableName ), access ); err != nil {
200201 return nil , err
201202 }
203+
202204 return s .toTokenInfo (item .Data )
203205}
204206
205- // GetByRefresh use the refresh token for token information data
207+ // GetByRefresh uses the refresh token for token information data
206208func (s * TokenStore ) GetByRefresh (refresh string ) (oauth2.TokenInfo , error ) {
207209 if refresh == "" {
208210 return nil , nil
@@ -212,5 +214,6 @@ func (s *TokenStore) GetByRefresh(refresh string) (oauth2.TokenInfo, error) {
212214 if err := s .adapter .SelectOne (& item , fmt .Sprintf ("SELECT * FROM %s WHERE refresh = $1" , s .tableName ), refresh ); err != nil {
213215 return nil , err
214216 }
217+
215218 return s .toTokenInfo (item .Data )
216219}
0 commit comments