cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFighterData

func DeleteFighterData(ctx context.Context, cfg *pgxs.Config) error

DeleteFighterData deletes all records from the fighters and fighter_stats tables.

func Execute

func Execute()

Execute runs the root command for the Fighters service. It executes the necessary logic for the command-line interface, handling errors and logging them if they occur.

func ReadFighterData

func ReadFighterData() ([]model.Fighter, error)

ReadFighterData reads fighter data from a JSON file and returns a slice of model.Fighter. The file path is set to "../../scraper/collection/fighters.json".

func WriteFighterData

func WriteFighterData(ctx context.Context, data []model.Fighter, cfg *pgxs.Config) error

WriteFighterData writes fighter data to a PostgreSQL database using the provided context, and a slice of model.Fighter. It connects to the database using the configuration from ViperPostgres and performs create or update operations for each fighter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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