forked from electricdusk/rushlink
Fix gopls issues
This commit is contained in:
parent
6603ad886f
commit
30ab6f9228
@ -2,14 +2,12 @@ package db
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/base64"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gobmarsh "gitea.hashru.nl/dsprenkels/rushlink/pkg/gobmarsh"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -84,7 +82,6 @@ func ErrHTTPStatusCode(err error) int {
|
|||||||
|
|
||||||
// Base64 encoding and decoding
|
// Base64 encoding and decoding
|
||||||
var base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
var base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
var base64Encoder = base64.RawURLEncoding.WithPadding(base64.NoPadding)
|
|
||||||
|
|
||||||
func (t PasteType) String() string {
|
func (t PasteType) String() string {
|
||||||
switch t {
|
switch t {
|
||||||
@ -158,12 +155,6 @@ func GetPasteNoValidate(db *gorm.DB, key string) (*Paste, error) {
|
|||||||
return &ps[0], nil
|
return &ps[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodePaste(storedBytes []byte) (*Paste, error) {
|
|
||||||
p := &Paste{}
|
|
||||||
err := gobmarsh.Unmarshal(storedBytes, p)
|
|
||||||
return p, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save saves this Paste to the database.
|
// Save saves this Paste to the database.
|
||||||
func (p *Paste) Save(db *gorm.DB) error {
|
func (p *Paste) Save(db *gorm.DB) error {
|
||||||
return db.Save(p).Error
|
return db.Save(p).Error
|
||||||
|
Loading…
Reference in New Issue
Block a user