pkg

package
v0.0.0-...-18d7254 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTable

func CreateTable(db *sql.DB) error

func OpenDatabase

func OpenDatabase() (*sql.DB, error)

OpenDatabase opens a connection to the PostgreSQL database and returns the connection object.

func SaveData

func SaveData(db *sql.DB, id, name, createdAt string) error

SaveData saves the fetched bread data to the PostgreSQL database.

Types

type ContentfulResponse

type ContentfulResponse struct {
	Sys struct {
		ID        string `json:"id"`
		CreatedAt string `json:"createdAt"`
	} `json:"sys"`
	Fields struct {
		Name string `json:"name"`
	} `json:"fields"`
}

ContentfulResponse represents the JSON response from the Contentful API.

func FetchContentfulData

func FetchContentfulData(url string) (*ContentfulResponse, error)

FetchContentfulData fetches data from the Contentful API and returns the response as a ContentfulResponse struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL